Git Product home page Git Product logo

redux-example's Introduction

React + Redux example

Also includes ReactRouter, Immutable for Universal (isomorphic) application. This is good start for those who want a full solution to work with a RESTful API. This project is written with ES7 and uses Babel to transpile to ES5.

Redux v1.0.0-rc is now available on npm. You can view the example for [email protected] on branch redux@rc.

##Installation

npm install

##Run

npm run dev

##How it works ###API Thanks to React and Redux, Server side and client side calls will run almost the same code for rendering.

The differences are in how api calls from the client and from the server (running the same code with client) are achieved. Server side calls may send information that is different from client, such as an accessToken field (which is received from each request's session), or may send to another api-server.

The api methods should therefore be different between server and client. You can take a look at implementations of the api method on the server (/lib/render.js) and client (/src/js/main.js).

###Why Immutable?

Data changing over time can cause some unpredictable errors. Immutable makes sure the referenced objects won't have their data changed over time. If you want to change the data, you must reference it to another object. For example:

handleStarButtonClick() {
  const repo = this.state.repo; // Assume we use Immutable for state.repo
  this.setState({
    repo: repo.set('starred', true)
  });
}

##TODO

  • Improve english.
  • Rewrite README.md
  • Add inline-style.
  • Prevent first loading when having initial state.
  • Loading indicator.

redux-example's People

Contributors

gaearon avatar quangbuule avatar swordsreversed avatar

Watchers

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