10 Cool React Tips

alexandrudanpop

Alexandru-Dan Pop

Posted on August 2, 2020

10 Cool React Tips

Hello Dev Community! ๐Ÿ‘‹

Today I will talk about some React tips I want to share with you. Those will be in the form of some tweets that I posted.

Leave a ๐Ÿงก & ๐Ÿฆ„ if you like this article.

10 Cool React Tips โš›๏ธ

1. Create a Webpack config in a conveniant way using createapp.dev

2. Learn to automatically check Accessibility with Axe

3. Use Parcel for 0 config builds, even with Typescript

4. React testing library debug function

5. How to handle errors in React

There is a cool package created by on of the React core team members for Error boundaries.
You can check it out here.

6. Use function components and Hooks โœ”๏ธ

There are many reasons apart from just this being the trend. If you use function components it is much more probable to find libraries that expose hooks APIs.

Probably in the future a lot of libraries will only expose hooks APIs. You won't be able to use hook APIs with class components.

7. Use the React Context API for shared / global state

Simply put - I am seeing less and less use cases for Redux or other state management libraries considering in React we have the Context API.

With the Context API you are using the same paradigm as with regular useState or useReducer hooks. This is lowering the learning curve for new React developers as they don't need to learn Redux or some other state management library.

8. Distinction in React Testing lib for getBy* vs queryBy*

9. Learn to use React testing library correctly ๐Ÿš€

Doing this can skyrocket the confidence you have in writing tests and the production code that you write.

10. Correctly handling async await in React components

Learning how to correctly handle asynchronous code in React is difficult and can lead to a bugfest. I explain all the concepts and how to deal with it in a simple way in one of my other dev articles:

If you are like me and always searching for better ways to improve your React, Javascript and Typescript experience, consider following me on Twitter where I post more cool content.

๐Ÿ‘‡ Comment below ๐Ÿ‘‡

Let me know if this is valuable for you and share some cool stuff you learned about React lately.

๐Ÿ’– ๐Ÿ’ช ๐Ÿ™… ๐Ÿšฉ
alexandrudanpop
Alexandru-Dan Pop

Posted on August 2, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

ยฉ TheLazy.dev

About