PentaBAR #56 // From Redux to Hooks and Context: A Case Study


We are starting off the year right with a PentaBAR designed for the FrontEnd community.

Bogdan B., our colleague, has prepared a mind-blowing presentation for the React lovers or other JavaScript frameworks fanatics, beginners or experienced.

💻 The agenda:
- React Hooks introduction
- Class Components vs. Hooks
- Study case: migration from Class Component to Hooks

👨‍💻 About the speaker:
Senior in his professional experience, but young at spirit, Bogdan B. started his journey in programming with C#, PHP & JavaScript. The latest hooked him. The power of this language, the simplicity, the flexibility made him explore all its frameworks/libraries. It was love at first component for Bogdan and React. He studied all the docs, he walked through all the tutorials, he learned as much as he could, he started teaching others in our PentaStagiu trainings or inside Pentalog’s internal communities. Bogdan is not an ordinary programmer, he’s an inspiration.

This is how he describes his PentaBAR:
„From React 16.8, Hooks are a new addition. They are JavaScript functions that allow functional components to access state and life cycle methods. From that moment, the community has shifted towards functional components.
After the release of React Hooks API, Redux also released its own version of Hooks (7.1.0), adding support for existing React-Redux API. The addition of hooks for React-Redux was much needed and it’s not the only one, other libraries have implemented and now support hooks.
In the React-Redux ecosystem, HOC components are usually used to inject the additional data, functions, props or state. These components act as a wrapper. When HOC renders a single component, Hook API can be an alternative, eliminating the wrapper. Using HOC’s with multi-layer wrappers, sometimes can be hard to maintain.
In my opinion, using Hooks instead of Redux for state management is by no means easier and not always necessary.
You have to be already familiar with the underlying concepts. Without relying on Redux, you will lose out-of-the-box performance optimizations, middleware support, devtools extension, time travel debugging and other things.”

🍻 Cheers! 🍻