Coder Social home page Coder Social logo

okeresamuel / the-usereducer-hook Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 1.95 MB

useReducer is one out of fifteen (15) react built in hooks it helps in managing multiple states that relates to each other an example would be making an api request or handling multiple form fields

JavaScript 53.88% HTML 31.45% CSS 14.67%
reacthooks reactjs state-management-in-react hook hooks react react-hooks

the-usereducer-hook's Introduction

The-useReducer-Hook

useReducer is one out of fifteen (15) built in react hooks. it helps in managing multiple states that relates to each other example would making an api request or handling multiple form fields

There are many different hooks in react let's look at the useReducer

The function of the useReducer hook is based on managing multiple states that are related to each other

some examples and use cases are managing multiple form inputs or making an API request

The useState hook is similar to the useReducer hook But the differences are,

The useState hook can be used to manage one or two states but when there are multiple states, creating so many useState hooks can get messy.

Its a good idea to use the useReducer hook to manage multiple states and as well improve readability (dry) ☀️

*** The code show how to use the useReducer hook to manage multiple states in this case we are making an api request to fetch user informations from an external database.

Screenshot (25)

Read more: https://medium.com/@okeresamuel360/the-usereducer-hook-in-react-5b3a4af93af5

the-usereducer-hook's People

Contributors

okeresamuel avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.