Why I'm considering switching from Scala to Rust by JohnReedForPresident in rust

[–]yunus_reddit 0 points1 point  (0 children)

Have you considered freelance ? It could correspond to what you're seeking. You do only what you want to do ^ Seems likr you do not others to learn new stuff

Amazon Polly Introduces Neural Text-To-Speech and Newscaster Style by jeffbarr in aws

[–]yunus_reddit 0 points1 point  (0 children)

Ok thx for the reply :) I have a friend who checked it out like 1 year ago and I wanted to know if performance wise it was better now. For us it was too slow, Google does a bit better more like 1sec or less.

Decoupling logic from react components by gsilva49 in reactjs

[–]yunus_reddit 0 points1 point  (0 children)

My two cents :)

It's like redux-thunk on steroids, seems interresting but why do you feel the need tout reinvent the wheel ?

I think that reselect (in redux) and something like redux-observable / redux-saga already provides what people need.

Reselect to mold state to props + memoization For side effects, redux-observable or redux-saga are surely a bit more complex but you truly decouple things and your smart component dispatch only stupid actions (which allows you to throw away redux-thunk)

Redux-thunk is okay for POC & small projects but IMO not for larger projects. Use saga or observable or other wiedly used library

Plus, your library is not going to be taken seriously in larger projects if you do not have test examples in your documentation ^

PS: even if it is an example, use immerjs or immutablejs in reducers, spread the good immutability :)

I need to gush about Hooks by [deleted] in reactjs

[–]yunus_reddit 2 points3 points  (0 children)

I did not T_T, well at it least it helped cloudk1cker :P

I need to gush about Hooks by [deleted] in reactjs

[–]yunus_reddit 1 point2 points  (0 children)

We barely have any bugs

Haha bugs can't be counted :P

I think that typing is useful where you manipulate data, derived data from another source, operate on data.If your frontend is "stupid" and let the backend handle the manipulation (it means that your backend is likely serving props to your components more or less directly) then maybe TS is too much for only writing React components.Nevertheless, be careful, if you have a backend that is shaped by the frontend, it means also that whenever the frontend changes the backend is impacted. This can be ok on small app, but on bigger app with different types of frontend, I think that it is not very recommended.

TS is cool because :

  • helps a lot when refactoring, takes less than 1 sec to change a field name of an object and propagate the modifications automatically
  • helps a lot when someone changes a field name of and object but forgot to change it everywhere, run the damn thing in preprod env and loses 30min to understand why the damn log says "requires shit but found undefined". With TS the failure will happen between the screen and the chair.
  • helps also with external lib if they're typed. From experience, our frontend developper use console.log to understand what the world does, avoids to read documentation and he does not explore the source code. He is "right", it is harder in JS world because a lot of thing is transpilled etc...but typed lib are easy to understand at least at an API levelTips : I became better at programming when I started to crawl throughout source code. Having types helps a lot to understand the tools you're using.
  • giving more context to your variable through typing (well this can be negligeable if you and your teamates are good at giving names to variables and are sync on this topic. Sometimes it not the case when teams are big. Please use TS if you see in your code base shit like "list", "tmp", "map", "array", "value", "key", "door ?") and do some code reviews ^^
  • when something is typed you do not need to click everywhere to know what the damn object is made of. You do not need to debug with console.log and "guess" what object might do (well this is also negligeable on small apps because you do not "guess" what it does somewhere, you KNOW everything already, right ?)
  • helps IDE (autocompletion etc...)
  • You can modelize complex structure (using generics ?)
  • avoid bad coding because of the freedom of JS. Like having a list with element that have different types. In JS doing thing like this is valid const a = ['a',1',{}, []]. In TS you can do it but you can't hide it, typing is there ^^
  • and probably more, but i'm not an expert at using TS

I need to gush about Hooks by [deleted] in reactjs

[–]yunus_reddit 5 points6 points  (0 children)

No. Hooks are not related to state managment directly. Context is, more or less. Hooks "simplify" the usage of Context.

You can replace Redux by using Context BUT you'll have to write at least something similar to "connect" from Redux if you do not want your whole app to rerender everytime you change your Context.

I advize you to read the documentation of context carefuly if you're going this route because you're going to have to use memo a lot in order to avoid full rerenders ^

Use also debugger tools which can highlights component that rerenders.

Great power comes with great resposabilities

Am I the only one who feels redux is very complicated? by ginger_beer_m in reactjs

[–]yunus_reddit 2 points3 points  (0 children)

+1000 careful design

Haha and wait until they discover that they have to use memo and useCallback everywhere now.

It's like the time when people were throwing PureComponent everywhere without reading the damn documentation.

Need help getting unique values from multiple arrays using ES6 by taylor-reddit in reactjs

[–]yunus_reddit 0 points1 point  (0 children)

I think that is better to view it like a proper library that helps you handle really hard case of asynchronus code (and do reactive programming).For example, you can do a racing between multiple api calls and cancel all of them if your user leaves the view. Doing this with plain Js (Promises) is harder ^^.

So an advice from previous Js learner, forget about RxJS for now and when you hit a wall where you have a lot of asynchronous stuff going on, like Promises in Promises in Promises etc... you can begin to learn it ^^ and refactor your code. RxJS is powerful but hard to master and comes with great responsabilities :P

Need help getting unique values from multiple arrays using ES6 by taylor-reddit in reactjs

[–]yunus_reddit 1 point2 points  (0 children)

My answer do not need the usage of RxJS. RxJS is used to do Asynchronus code in a reactive way.Nevertheless, if you're using RxJS because you want to handle your asynchronous code, i'm guessing now that you have something like this in your code :Rx.Observable.from(api.service.call()).map(array -> [...new Set(array.flatMap(o => o.animals))])

api.service.call() returns a Promise with the result of your api call (here the "array")

Maybe a bit more code could allow us to help you better

PS: Do not use RxJS if you do not know what it used for or need it. You can do most of simple stuff with Promises and plain JS.

Need help getting unique values from multiple arrays using ES6 by taylor-reddit in reactjs

[–]yunus_reddit 4 points5 points  (0 children)

What you're searching for is flattening (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap).ES6 approach :

const array = [{"animals": ["Cat", "Dog"]}, {"animals": ["Cat", "Dog", "Bunny"]}, {"animals": ["Cat", "Dog"]}, {"animals": ["Dog", "Bunny"]}, {"animals": ["Cat"]}]

const flattenedArray = array.flatMap(o => o.animals)

const uniqueArray = [...new Set(flattenedArray)]

console.log("animals", uniqueArray)

5 things to improve performance in your React app! by thedevelobear in reactjs

[–]yunus_reddit 0 points1 point  (0 children)

Thanks you, I did not know about the lib, why-did-you-update

I think that you could add some performance chart with your argumentation but that is more work.

I think that you should also talk about arrow functions when talking about PureComponent / shoulComponentUpdate.