Ugh, the dependency injection stuff is just Angular all over again. export default wire(Title, ['title'], function resolve(title) { return { title }; }); Now I have to register "title" somewhere. Where is it registered? Did I remember to register it? I no longer know what's going on just by looking at the file in front of me, and my linter is silent. Then I have to annotate the function and declare it in the argument…
React in patterns
21–30 of 52 posts
Re: React in patterns
#22here is some advice: don't use redux or any sort of state library, just use a normal state object, it only clutters your code.
I'd say really good advice I wish I had known was don't start with a flux implementation. Build out your app with standard react state, use state only at last cost (ie derive logic off of props or whatever else via functions before storing state data), and only when you get into a bit of mess with a really large application and too much difficulty deciphering what components are providing logic and how they interact with each other should you implement a flux.
Also, it's worth watching Dan Abramov's learning redux course on egghead just for how it gets you to think about react, javascript, and GUI development in general.
Re: React in patterns
#23Ugh, the dependency injection stuff is just Angular all over again. export default wire(Title, ['title'], function resolve(title) { return { title }; }); Now I have to register "title" somewhere. Where is it registered? Did I remember to register it? I no longer know what's going on just by looking at the file in front of me, and my linter is silent. Then I have to annotate the function and declare it in the argument…
Re: React in patterns
#24I literally don't know where to get started with React. Does anyone have any resources for a web design newbie?
[1] "ReactJS for Stupid People" - this explains what React is in simple meaningful terms.
[2] "React.js Introduction For People Who Know Just Enough jQuery To Get By" - this shows you how things are usually done with just jQuery compared to how it's done in React. It really allows you to see why the jQuery way sucks.
[3] "Flux For Stupid People" - by reading this you'll understand what the Flux stuff is about and can decide whether you need it or not - I chose to skip it.
Finally, if you want to get up to speed with ES6 classes at the same time, [4] shows you a simple example. I personally started writing my React stuff this way straight away.
I'm liking React a lot at this point.
[1]: http://blog.andrewray.me/reactjs-for-stupid-people/ [2]: http://reactfordesigners.com/labs/reactjs-introduction-for-p... [3]: http://blog.andrewray.me/flux-for-stupid-people/ [4]: http://www.tamas.io/react-with-es6/
Re: React in patterns
#25Ugh, the dependency injection stuff is just Angular all over again. export default wire(Title, ['title'], function resolve(title) { return { title }; }); Now I have to register "title" somewhere. Where is it registered? Did I remember to register it? I no longer know what's going on just by looking at the file in front of me, and my linter is silent. Then I have to annotate the function and declare it in the argument…
Re: React in patterns
#26I literally don't know where to get started with React. Does anyone have any resources for a web design newbie?
Beyond that, I maintain a big list of links to high-quality articles on React and related topics, at https://github.com/markerikson/react-redux-links . It's specifically intended to be a great place to start learning the ecosystem. Just for React, my list points to a couple dozen tutorial articles, a number of build-a-project tutorials, a number of articles that dig into how React works internally, and several paid courses and full books ( https://github.com/markerikson/react-redux-links/blob/master... ).
Re: React in patterns
#27Ugh, the dependency injection stuff is just Angular all over again. export default wire(Title, ['title'], function resolve(title) { return { title }; }); Now I have to register "title" somewhere. Where is it registered? Did I remember to register it? I no longer know what's going on just by looking at the file in front of me, and my linter is silent. Then I have to annotate the function and declare it in the argument…
Completely agree. I don't see many people in the React community advocating the use of DI though, so that's a plus. The DI in Angular made a little bit of sense because JS modules weren't very widespread back then. But now, with ES6 imports (and/or 'require') there's no need. We have real modules now, and they can be dynamically injected for testing purposes with something like inject-loader[0]. I think Angular and/o…
Re: React in patterns
#28I am struggling a little with Flux, everyone has their own implementation of it. I mean that is grand, but what does it actually mean for me? Contextless. Thanks for sharing :)
Don't implement Flux or Redux until you need it. This is what most React experts keep saying, but there are a ton of entry-level tutorials trying to teach both React concepts and Flux concepts (probably because it's a cool pattern). For most small apps, it's unnecessary. Pass state down as props.
Re: React in patterns
#29here is some advice: don't use redux or any sort of state library, just use a normal state object, it only clutters your code.
Later, when you do a real project, Redux makes debugging and state consistency about 10 times easier, especially on a team or coordinating between multiple teams.
Re: React in patterns
#30Ugh, the dependency injection stuff is just Angular all over again. export default wire(Title, ['title'], function resolve(title) { return { title }; }); Now I have to register "title" somewhere. Where is it registered? Did I remember to register it? I no longer know what's going on just by looking at the file in front of me, and my linter is silent. Then I have to annotate the function and declare it in the argument…