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.
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
There is a cool package created by on of the React core team members for Error boundaries.
You can check it out here.
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.
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
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.
When testing components using React Testing lib, make the disctinction between:
◆ getBy* - return the first matching node and throws an error if no elements match
◆ queryBy* - return the first matching node for a query or null
#100DaysOfCode #programming19:15 PM - 29 Jul 2020
Doing this can skyrocket the confidence you have in writing tests and the production code that you write.
✅ learn to use React Testing library correctly. It does have some gotchas and things that take time and practice to learn.
Once you master it, it's super easy to test #reactjs components.
#test #automation #100DaysOfCode07:40 AM - 01 Aug 2020
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:
Let me know if this is valuable for you and share some cool stuff you learned about React lately.