React Stack 2021
Tags: react, webdev
Published: 2021-04-04 16:15:43

Over the last few years, there have been some big changes in React itself, and the ecosystem has evolved quite a bit too.

Here’s where things stand in 2021.

1. [React](https://reactjs.org/):
Well isn't that obvious, since we are talking about the React Stack after all. We all know how React has seen a rise in popularity to become one of the most loved front-end frameworks of all time. This also means more developers are building projects in React than ever before.

2. [TypeScrpt](https://www.typescriptlang.org/):
TypeScript is a typed superscript of JavaScript that compiles to plain Javascript, by using React and TypeScript together we get the benefit of statically typed language for the user interface and also lowering the probability of shipping and bugs to the front-end.

3. [React Router](https://reactrouter.com/web/guides/quick-start):
React Router is still the dominant router when building medium to large scale Single Page Applications. It is currently up to v5 (almost v6) and the API has changed a bit since earlier versions.

4. [Redux](https://redux.js.org/):
State management libraries help us to manage the data in our application. The new official [Redux Toolkit](https://redux-toolkit.js.org/) is excellent and is the recommended approach to use Redux in 2021. If you are going to use Redux, be sure to check those out.
Other alternatives available [MobX](https://mobx.js.org/README.html), [Recoil](https://recoiljs.org/) and also using React hooks (useContext + useReducer)

5. [React Query](https://react-query.tanstack.com/overview):
On the data-fetching front, the strategy of putting everything in Redux or a global store is getting less common. React Query does a good job at fetching data and managing loading/success/error states and we can definitely use both Redux and React Query in the same project. It takes care of maintaining that global data cache across component boundaries without you really having to think about it. Definitely worth a look if you are working with a lot of async data fetching.

6. [Chakra UI](https://chakra-ui.com/):
Chakra UI has an abundance of components and works with the styled system approach which I personally prefer. Another alternative [Material UI](https://material-ui.com/). Using a component library is a personal choice.

7. React Forms:
[Formik](https://formik.org/docs/overview) and [React Hook Form](https://react-hook-form.com/) seem to be the favorites right now, with hook-form gaining steam. Both supports schema-based form validation with [Yup](https://github.com/jquense/yup) where you can pass your schema as an optional config. The form will validate your input data against the schema and return with either errors or a valid result. Formik or React Hook For with Yup validation library is definitely a swiss knife for all things related to forms in React.

8. [Jest](https://jestjs.io/) + [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/):
When it comes to testing I personally prefer Jest with React Testing Library as my go-to packages and they are in fact [recommended by the react official documentation](https://reactjs.org/docs/testing.html#tools). What is great about react-testing-library is that it encourages you to write tests that resemble the way the users would interact with your software this helps you avoid implementation details.

9. [Storybook](https://storybook.js.org/docs/react/get-started/introduction):
Storybook is basically a development environment and playground for UI components. It enables you to create components independently and showcase those components interactively in an isolated development environment. When working on projects storybook allows the front-end team to show the components to the stakeholders.

10. [Next.js](https://nextjs.org/):
Next Js is a React framework that gives an excellent developer experience with all the features that you would need to build a fantastic application, there is hybrid,  static and server-side rendering, Optimized SEO, image caching, TypeScript support, built-in routing, API conventions, and a lot more. It might probably be most if not every React project might be built in the coming years.

Do let me know if I have missed some of them in the comments below.
Thanks for your time reading. Drop a few ❤️ or 🦄 if you like it.