Giter VIP home page Giter VIP logo

easy-react-redux's Introduction

Easy-React-Redux

simple example about using React && Redux

Redux component && methods Used

  • <Provider /> is the higher-order component provided by React Redux that lets you bind Redux to React, need to be imported import { Provider } from 'react-redux';.

  • createStore(reducer, [preloadedState], [enhancer]) Creates a Redux store that holds the complete state tree of your app, there should only be a single store in your app, need to be imported import { createStore } from 'redux';.

  • dispatch(action) Dispatches an action. This is the only way to trigger a state change.

  • getState() Returns the current state tree of your application. It is equal to the last value returned by the store's reducer.

  • subscribe(listener) Adds a change listener. It will be called any time an action is dispatched, and some part of the state tree may potentially have changed.

combineReducers(reducers) it turns an object whose values are different reducing functions into a single reducing function , the resulting reducer calls every child reducer, and gathers their results into a single state object, need to be imported import { combineReducers } from 'redux';.

  • mapStateToProps() specify exactly which slice of the state we want to provide to our component.

  • mapDispatchToProps() specify exactly which slice of the Action we want to provide to our component.

  • connect([mapStateToProps], [mapDispatchToProps], [mergeProps], [options]) Creates a higher-order component for making container components out of base React components, need to be imported import {connect} from 'react-redux';

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.