r/javascript • u/adstwlearn • Jun 28 '18
The exact same app - 1 version made with React, Redux, and React-Router The other made with Vue, Vuex, Vue-Router. Good if you want to see both worlds. User Auth with JWT, note CRUD actions, Koa (Node) backend. MIT license.
https://johndatserakis.github.io/koa-react-notes-web/
459
Upvotes
5
u/TheMr_ Jun 28 '18 edited Jun 28 '18
In regard to the return function, I see it as more separation of concerns. JSX is already being intermingled within each component alongside the normal JavaScript. For me, I'd say it helps keep the UI and Data separated more. What I found when learning React was that it tries to rely heavily on vanilla js where it can. Learning React taught me a lot more what could be done with vanilla js and has improved my overall understanding of just javascript as a whole.
And with that, it's fairly easy to loop over data within React just with plain javascript. Simply map over an array and pass in a component or element to be returned.
Which will be rendered as the following into its parent container
You can also use the filter and map functions in conjunction to check whether an item should be rendered at all.