Posts

Showing posts from November, 2019

Getting started with React Hooks

Image
React Hooks came into production with React v16.8 and it has completely changed the way we were thinking and using React. React Hooks enables us to build components using the functional approach instead of an object-oriented (classes) approach. So the big question here is – What is React Hooks and why is everyone so excited about them. But before we discuss what React Hooks actually are, it is very important to understand the challenges that we are currently facing with React and how Hooks can help us solve these challenges. For a deeper understanding, you can check out the official docs on React Hooks . Challenges in React Challenge 1 – Hard to reuse stateful logic between different components In React, it is very hard to reuse stateful logic between different components. React does not offer a way to attach reusable behavior to a component. So if you have worked with React, you do understand things like higher-order components or render props to help solve this iss...