GithubHelp home page GithubHelp logo

react-manage-state's Introduction

React State Manage

You can review difference methods to manage state in react by checkout others branch.

How to use it

  • Clone thie repository bt following command

    > git clone [email protected]:ZhongJunJimmy/react-manage-state.git

  • Checkout others branch to review difference methods

    > git checkout react-simplest | react-hook | react-context | redux-sample

React Simplest

  1. The React Component Types — Class-Based Component and Function Component
  2. Before the 16.8 version of React:
    • The class-based type is required if the component will manage the state data and/or lifecycle method (more on this later). Hence, it is called a stateful component.
    • The function component type cannot maintain state and lifecycle logic. And as such, it is referred to as a stateless component.
  3. Unidirectional flow
  4. This type is the simplest form of React component because it is primarily concerned with how things look.

React Hook

  1. Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class.
  2. Only Call Hooks at the Top Level
    Don’t call Hooks inside loops, conditions, or nested functions.
  3. Only Call Hooks from React Functions
    Don’t call Hooks from regular JavaScript functions.

React Context

  1. Solved Props drilling issue without third Party Packages

Redux Sample

Action -> Reducer -> Store -> UI

  1. Action: An object describing "what happened"
  2. Reducer: An function that takes a current state value and an action object, and returns a new state value.

To be continue...

react-manage-state's People

Contributors

zhongjunjimmy 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.