React Best Practices for 2021
blog.asayer.io
React Best Practices for 2021
1–7 of 7 posts
Re: React Best Practices for 2021
#2Re: React Best Practices for 2021
#3Using hooks and useMemo? That's essentially stolen from the React tutorials.
Pure functions? Sure, that's useful but the example is ridiculous. How would you have an impure comparison function?
In general not a huge fan of these filler content marketing front end posts. If you're gonna advertise your company, at least provide some interesting content.
Re: React Best Practices for 2021
#4There's many other articles that are much more useful than this one. To point to a few off the top of my head:
- https://alexkondov.com/tao-of-react/ : a useful list of patterns and practices when writing React code
- https://leerob.io/blog/react-state-management : a recent summary of how React state management approaches have changed over time, with some current suggestions
- https://daveceddia.com/react-ecosystem-overview/ : a summary of the React ecosystem as it currently stands
and I personally have put up a lot of material over the last year that is _much_ more useful than this:
- https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-...: a deep technical dive into how React rendering works (when, why, how, and nuances in behavior), including looks at how Context and React-Redux interact with rendering
- https://blog.isquaredsoftware.com/2021/01/context-redux-diff... : a comparison of the capabilities and use cases for React's Context API, the `useReducer` hook, and Redux/React-Redux
- https://blog.isquaredsoftware.com/2020/12/presentations-reac... : an updated intro to React with hooks, Redux / Redux Toolkit, and TypeScript
Any one of the posts I just linked would be much more worth your time.
Re: React Best Practices for 2021
#51. Use TypeScript to catch errors early
2. Use hooks
3. Build your data access layer as custom hooks -- e.g. const { isLoggedIn, loggin } = useAuth();
4. Tips on refactoring to have testable components
5. Understand when to use memoization -- expensive is in the eye of the beholder.
Re: React Best Practices for 2021
#6Meh. These aren't great tips. One of these tips is for class components, which while still relevant, aren't exactly new as of 2021. I learned that class binding trick in 2017. Using hooks and useMemo? That's essentially stolen from the React tutorials. Pure functions? Sure, that's useful but the example is ridiculous. How would you have an impure comparison function? In general not a huge fan of these filler content…
All the other examples I see are very much just filler, and some end up being true spam.