Giter VIP home page Giter VIP logo

react-redux-example's Introduction

A Simple Redux Example / A Simple React Redux Example

Learn how to use Redux with React. This sample is organized to be understandable, reusable and enjoyable!

Quickstart

  1. Clone the project
  2. Install your dependencies with npm install
  3. Run your application with npm start
  4. Read index.js
  5. Read all the files in the 'Redux' folder
  6. Read all the .js files in the 'React_Components' folder

Understanding Redux in a nutshell

Redux is composed of the following parts:

  • State
  • Redux Store
  • Reducers
  • Actions

State is where information is stored. You may have seen 'state' before with this.setState(...) in React components.

Redux Store (usually just called store) is where the Redux keeps its state. React components can interact and retrieve the state from the redux store. This store is constructed with a reducer, initial state, and enhancers (see below).

Reducers are used to update the state within the store. Reducers takes in a state and an action, and returns new state. They are named this way, because Reducers 'reduce' state and actions into that single new state.

Actions are objects sent to reducers to update state. A function that returns an action is an action creator. When using an action creator and react-redux's connect, a React component can update the state of the Redux Store.

Side note: Enhancers are functions that enhance the Redux store with third-party capabilities.


Why Redux?

Redux creates a place where information can be viewed/manipulated from any component. Redux scales with your project, allowing you to focus on new functionality rather than bugs from passing state through a large component tree.

For more reasons why you may/may not want to use Redux, read the following article: https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367

react-redux-example's People

Contributors

dragondev-king avatar

Stargazers

 avatar  avatar Notorious K avatar Winter Solstice avatar Ken Abe 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.