A guide to useState in React

added by JavaScript Kicks
3/20/2019 8:14:25 AM


useState is a hook that allows you to have state variables in functional components. There are two types of components in React, class and functional components. Class components are ES6 classes that extend from React.Component and can have state and lifecycle methods: Functional components are functions that just accept arguments as the properties of the component and return valid JSX: As you can see, there are no state or lifecycle methods.