redux-tutorial
This repository contains a step by step tutorial to help grasp flux and more specifically Redux.
The official and very exhaustive Redux documentation is available here and should be your number one source of truth regarding Redux. The present tutorial will only offer you an introduction to flux concepts through Redux use. For further or more detailed info, please refer to the Redux documentation.
Prerequisites
It is required for you to know a bit of ES6 and ES7 (Object Spread) to correctly understand some of the examples given in this repo. Also be aware that this tutorial targets redux 3.0.2 and react-redux 4.0.0.
Clone the repository
git clone https://github.com/happypoulp/redux-tutorial.git
Move into repository
cd redux-tutorial
Install dependencies
npm install
Browse the tutorial
This tutorial is split into a sequence of javascript files that are intended to be read in order.
Start with the first tutorial: Introduction
Run an example
Being real js files, each example can be run to verify that it works as intended or to do your own experiments:
npm run example 01_simple-action-creator.js
Enjoy!
from https://github.com/happypoulp/redux-tutorial
-------------
Awesome list of Redux examples and middlewares.
Awesome Redux
List of repositories which use Redux
Unofficial documentation of Redux(Russian version) (Work in progress)
Documentation of Redux(Japanese version) (Work in progress)
Documentation of Redux(Portuguese version) (Work in progress)
Documentation of Redux(Spanish version) (Work in progress)
Predictable state container for JavaScript apps
Marks
Presentations
- A introduction about Redux
- Real World Redux
- The power of higher-order reducers
- Reactive Architecture with Redux and Angular
- Redux Internals
- Replacing Angular 1 with React and Redux
- A tour on the React ecosystem
- Redux from Twitter hype to production
Resources
- Many tools and middlewares
- Blog which is written with Redux
- Redux offline docs
- Flux challenge
- Sound Redux - a simple Soundcloud client
- Favesound Redux - SoundCloud Client for Artists
- Structor - a user interface builder for React
- generator-redux - CLI tools for Redux: next-gen functional Flux/React with devtools
- generator-reactapp - Yeoman generator for react app with redux
- Spectacle - ReactJS based Presentation Library
- Notes (and partial transcription) of Dan Abramov's Redux course videos on http://egghead.io
- Comprehensive Notes for Learning (how to use) Redux to manage state in your Web/Mobile Apps
- React Redux [RU tutorial]
- Redux without profanity
- React and Redux Single Page Applications Resources
- A categorized list of Redux-related addons, libraries, and utilities
- Building the F8 2016 App (Redux, GraphQL, React Native)
- The Elm Architecture in JavaScript
Articles And Tutorials
- Building Applications with React and Redux in ES6 on Pluralsight
- Writing a Basic App in Redux
- Learn how to use Redux step by step
- Tutorial: Handcrafting an Isomorphic Redux Application (With Love)
- 0 to 1 : Getting started with Redux
- Redux Chinese Document
- Redux Document (Traditional Chinese)
- Relay and Routing
- Understanding Redux Middleware
- Several videos about Redux + Falcor and Example code
- Redux Middleware: Behind the Scenes
- A proposal for bundling reducers, action types and actions when using Redux
- Full-Stack Redux Tutorial - A Comprehensive Guide to Test-First Development with Redux, React, and Immutable Source Server + Client
- Redux best practices
- The 3REE Stack: React + Redux + RethinkDB + Express.js
- React Tutorial - Converting Reflux to Redux
- Redux example using 500px API (with ES6)
- Building a boilerplate for a Koa, Redux, React application including Webpack, Mocha and SASS - This article explains in detail how this koa-redux-react-boilerplate was built and the technologies it uses.
- Typed React and Redux
- A cartoon intro to Redux
- Join The Dark Side Of The Flux: Responding to Actions with Actors
- Can I dispatch multiple actions from Redux action creators?
- Understanding Redux (or, How I Fell in Love with a JavaScript State Container)
- Your First Immutable React & Redux App
- Getting Started with Redux - Egghead's video lessons from Dan Abramov
- Redux Testing Video Lessons - a few short Egghead video lessons (some free, some require a subscription)
- Implementing a smart Login Modal with Redux, reselect and ReactJS
- How to Build a Todo App Using React, Redux, and Immutable.js
- Rethinking Redux
- Managing Side Effects In React + Redux Using Sagas
- Secure Your React and Redux App with JWT Authentication
- Getting started with Redux and GraphQL
- Data Flows with Angular 2 and Redux
- Simple Routing with Redux and React
- Redux nowadays : From actions creators to sagas
- Master Complex Redux Workflows with Sagas
- Angular 2 Application Architecture - Building Flux Apps with Redux and Immutable.js
- React, Redux and Immutable.js: Ingredients for Efficient Web Applications
- An Introduction to React Redux (Part 1)
- An Introduction to React Redux (Part 2)
- Rules For Structuring (Redux) Applications
- Redux for the very beginner
- Redux - Calling web service asynchronously
- Animating with React, Redux, and d3
- Build an Image Gallery Using React, Redux and redux-saga
- Introducing redux-operations
- Solving Redux’s shortcoming in 150 LOCs
- The Anatomy Of A React Redux App
- Getting Started with React, Redux and Immutable: a Test-Driven Tutorial (Part 2)
- Leveling Up with React: Redux
- Complete intro to react
- Recreating Redux — Behind the magic curtain
- Let's Build a Redux Powered React Application
- Deep Introduction to Redux - Seriese 1/3
- Universal Rendering with Redux and React-Router - Seriese 2/3
- Unit Testing Redux Apps - Seriese 3/3
- Using Aurelia and Redux together for good times all around
- Comparing Redux and Relay
- Building React Applications with Idiomatic Redux
- The SoundCloud Client in React + Redux
- 深入浅出 Redux
- Building Angular 2 applications with Immutable.js and Redux
- Tutorial: Building Redux in TypeScript with Angular 2
- Improving React and Redux performance with Reselect
- Recipes for Redux
- Getting Started with Redux & Angular 2
Boilerplate
- Modern and Scalable React/Redux Boilerplate - Flexible starter kit using Webpack 2 (tree-shaking) / React Hot Loader v3 / Code Splitting for React Router / PostCSS / CSS Modules / custom Ducks pattern app architecture / best practices / Sentry error tracking / Enzyme test environment 🚀
- react-production-starter - React boilerplate with isomorphic rendering, async react-router routes, async redux reducers, async data fetching, and code-splitting. 🔥
- mern.io - Simple full-stack boilerplate to get started with building isomorphic/universal apps, handles api part and also offers a cli to generate the boilerplate 🔥
- react-redux-starter - Universal React + Redux with Cordova support and an opinionated directory structure
- react-slingshot - React Redux Starter Kit with hot reloading, tests and example app
- react-redux-boilerplate - React Redux Boilerplate
- react-boilerplate - React + Typescript + Sass boilerplate
- react-redux-scaffold - Combination of redux, react-router and ES6+ support
- simple-redux-boilerplate - Simple and guided React, Redux boilerplate w/ Transform HMR! 🔥
- reactv - React Redux example
- redux-boilerplate - Boilerplate for Redux
- react-redux-starter-kit - Get started with React, Redux, and React-Router.
- simplest-redux-example - Simplest Redux + React example for beginners
- redux-easy-boilerplate - React Redux easy boilerplate
- dicty-redux - Starter kit to bootstrap React and Redux (Flux) based web application
- 3ree - Boilerplate & Demo for Universal Realtime Apps built with React + Redux + RethinkDB + Express
- react_scaffolding - React + React Router 1.0 + Redux + Webpack & Hot Module Replacement
- express-redux-sample - Express-Redux-PassportJs-MySQL Boilerplate
- redux-blog-example - Redux-Webpack-Babel Blog Platform boilerplate
- redux-undo-boilerplate - a magical boilerplate with hot reloading and awesome error handling
- redux500 - The Redux version of isomorphic500
- redux-demo - Redux port of SurviveJS - Webpack and React Kanban app
- react-redux-universal-hot-example - A starter boilerplate for a universal webapp using express, react, redux, webpack, and react-hot-loader
- rde - Reactive Live Programming Environment
- React Redux Starter Kit - Yet another React and Redux based web application starter kit
- skeleton - A simple project-stub to show the basic ideas. Also serves you as a quick start for your project (Mori + Redux)
- browser-redux - Building Chrome apps and cross-browser extensions with Redux and Webpack
- react-for-hipsters-boilerplate - Fresh boilerplate with brand new hot reloading confing and other hipster stuff
- Documented Koa Redux React Webpack boilerplate- The building process of this boilerplate is deeply documented from 0 for learning purposes. You can find the docs here.
- err - Electron, React, Redux-devtools boilerplate for building cross-platform apps.
- friends-app-redux - React Redux Universal Hot Example
- isomorphic-redux-app - Redux Isomorphic App (with async content)
- starter-kit - Project boilerplate using React, Redux and Uniloc http://unicornstandard.com/packages/boilerplate.html
- loopback-redux-react-boilerplate - A boilerplate for a Redux-React application using LoopBack
- breko-hub - Babel React Koa Hot Universal Boilerplate -- A simple, clean and consistent boilerplate for creating universal webapps with universal data fetching and SocketIO integration
- React Redux Cordova Boilerplate
- react-boilerplate - Performance orientated, offline-first boilerplate feat. hot-reloading, PostCSS and the best developer experience.
- react-webpack-node - Boilerplate for an universal React + Redux/alt Flux application using Webpack running on a node express server
- Hapi React Starter Kit - Universal, Redux, Redis, Socket.io, Intl
- Universal Redux Template - A clean, extensible react + redux boilerplate with universal rendering, testing and more
- universal-js - A universal Javascript starter kit inc. React, Redux, Redux Dev Tools, Universal Redux Router, CSS Modules, hot module reloading, Babel for ES2015+ and ESLint
- redux-react-material-boilerplate - Simple boilerplate inc. React, Redux, Hot reload and Material-ui
- react-redux-starter - React Redux Starter
- Reduxible - The Fast and Easy way to make a React + Redux apps
- react-workflow - A large SPA boilerplate for web development built on top of Facebook's React library,use redux architecture
- ReacToGo - A simple ES6 boilerplate with Redux architecture and ImmutableJS: Hot Reload, React UI Comp, Firebase, Router
- React/Redux simple CRUD with persistent state and local async actions (add a manifest file and you get an offline webapp)
- StarHackIt - An React/Redux Node full-stack starter kit with authentication and authorization code
- React Seed - A barebones scalable directory structure and package.json for facilitating new React + Redux projects. No fat to trim here!
- React/Redux with Auth boilerplate - Very simple boilerplate, good for fast creating admin panels / dashboard. Included: React, Redux, ReduxForm, React-Router, Simple Authenticate, Hot Reload and Webpack (with babel) 🔥
- Docker + React/Redux + Node + PostgreSQL - full stack boilerplate with fully dockerized workflows for development, deployment, testing
- Redux universal boilerplate - boilerplate for react universal application building on flux architecture based on redux implementation.
- React Redux Universal Boilerplate - An Universal ReactJS/Redux Boilerplate.
- react-hot-redux-firebase-starter - Starter boilerplate for using React/Redux with Firebase 3.0 API, include the new React Hot Loader 3.0 🔥
- React Redux Firebase Boilerplate - Designed for quickly spin up your apps with Firebase, using bunch of awesome new front-end technologies includes webpack build system, hot reloading, routing & sass support. 🔥
- React Universal Saga - Universal React Starter Kit ft. Redux Saga
- React Redux SoundCloud Client - Seed Project for a SoundCloud Client with working Login + Extension Seed Projects
- vortigern - A universal boilerplate for building web applications w/ TypeScript, React, Redux and more.
- angular2-redux-contact-list - Simple contact list built with Angular 2, Immutable.js and Redux
- Examples
- CarteJaune - An open source Redux/ExponentJS (React Native) app leveraging redux-saga to keep track of your vaccinations
- noder-react-native - The mobile app of cnodejs.org written in React Native
- react-native-redux-counter
- react-native-counter-ios-android
- react-native-redux-groceries - An example app using React Native, Redux, Firebase, and AsyncStorage for offline data
- react-native-sound-cloud
- snowflake - mobile app starter: Login, Logout, Reset Password, Update Profile, Hot Reload
- uestc-bbs-react-native - An iOS client for http://bbs.uestc.edu.cn/ written in React Native with Redux
- movies-redux - redux implementation of react-native movies example that is included in react-native source
- react-native-redux-todo-list - A sample todo list app developed by using react-native and redux
- Containers
- Middlewares
- redux-transduce - Transducer utilities for Redux
- redux-actions - Flux Standard Action utilities for Redux
- redux-promise - FSA-compliant promise middleware for Redux
- redux-sync-promise - Middleware for writing asynchronous actions in synchronous style
- redux-simple-promise - FSA-compliant promise middleware for Redux with simple behaviour with minimal boilerplate declarations
- redux-async - FSA-compliant promise property middleware for Redux
- redux-async-queue - Manage queues of thunk actions
- redux-async-initial-state - Set initial Redux state asynchronously
- redux-await - Manage async redux actions sanely
- redux-rx - RxJS utilities for Redux
- reselect - Selector library for Redux like in NuclearJS
- react-redux - React bindings for Redux
- redux-react-router - Redux bindings for React Router – keep your router state inside your Redux store
- redux-promise-middleware - Redux middleware for resolving and rejecting promises
- redux-thunk - Thunk middleware for Redux
- redux-batched-updates - Batch React updates that occur as a result of Redux dispatches, to prevent cascading renders.
- redux-combine-actions - Redux middleware that allows you to easy combine actions and dispatch them sequentially
- redux-catch-promise - Extended replacement of redux-thunk middleware to supporting async-await functions and implement server-side rendering for React components with async state
- redux-delegator - Compose redux reducers in a structured way
- routex - Simple router for Redux universal applications. Can be used with React too
- redux-persist-store - Persist and rehydrate a redux store
- adrenaline - React bindings for Redux with Relay in mind
- redux-localstorage - Store enhancer that syncs (a subset) of your Redux store state to localstorage.
- redux-storage - Persistence layer for redux with flexible backends
- redux-pouchdb - sync store state to pouchdb
- redux-vstack-router - Helpers to bind vstack-router to redux
- redux-create-store
- redux-batched-subscribe - Batch calls to subscribe handlers with a custom function, including debouncing or React batched updates.
- redux-logger - Logger middleware for Redux
- redux-node-logger - A Redux Logger for Node Environments
- redux-diff-logger - Diff logger between states for Redux
- redux-debug - debug(...) middleware for Redux
- redux-requests - Avoid issuing duplicate HTTP requests
- redux-owl - Redux One Way Linking
- redux-act - An opinionated lib to create actions and reducers for Redux
- redux-act-async - Reducing boilerplate when creating asynchronous actions in Redux
- redux-raven-middleware - Redux middleware for sending error reports to Sentry through raven-js
- redux-routing - Universal routing built on top of redux
- redux-undo - Simple undo/redo functionality for redux state containers
- rn-redux-mixpanel - Configurable Redux middleware that sends your actions & user profile data to Mixpanel
- redux-falcor - Connect your redux front-end to your falcor back-end
- redux-analytics - Trigger analytics events based on your event metadata
- redux-ignore - Ignore redux actions by array or filter function
- redux-recycle - Reset the redux state on certain actions
- re-notif A notification center based on React & Redux.
- redux-lunr - Make your redux store searchable with Lunr.js
- redux-ensure-fsa - Development middleware to check for FSA-compliant actions
- redux-pagan - internationalization via redux
- redux-debounce - Debounce your actions!
- redux-future - FSA-compliant future monad middleware for redux
- redux-io - FSA-compliant io monad middleware for redux
- redux-either - FSA-compliant either monad middleware for redux
- redux-timeout - Trigger actions based on timeouts
- redux-observable-middleware - Redux middleware for subscribing to observables
- redux-observable - RxJS 5-based middleware for Redux. Compose and cancel actions as epics.
- redux-deferred - Redux middleware for jQuery Deferred Object
- redux-task - A simple Side Effects manager for redux
- redux-gen - Generator based middleware for redux
- redux-authentication - Authentication component for Redux
- socket.io-redux - Redux middleware to emit action via socket.io
- redux-catch - Error catcher middleware for Redux reducers and middlewares
- redux-elm-middleware - Elm middleware for redux
- redux-api-middleware - Redux API middleware based on the real-world example
- redux-mediaquery - Redux ActionCreator to put responsive-design breakpoints in your store
- Tools
- reactotron - Control, monitor, and instrument your React Native apps from the comfort of your TTY
- redux-test-recorder - Redux test recorder is a redux middleware + included component for automagically generating tests for your reducers based on the actions in your app
- redux-devtools - DevTools for Redux with hot reloading, action replay, and customizable UI
- react-router-redux - Ruthlessly simple bindings to keep react-router and redux in sync
- redux-tiny-router - A Router made for Redux, stop using the router as a controller it's just state!
- redux-devtools-gentest-plugin - Generate mocha like tests from redux-devtools session
- generator-redux - CLI tools for Redux: next-gen functional Flux/React with devtools
- generator-reactapp - Yeoman generator for react app with redux
- generator-redux-app - Scaffold out a redux app with counter example and react-router
- redux-loader - A high order component for Redux. This components loads resources and passes them to the child components via props
- redux-rest - Automatically create Flux action constants, action creators and Redux reducers for your REST API
- react-reach - A library to communicate with Graphql through Redux
- redux-api - Flux REST API for redux infrastructure
- firedux - Firebase + Redux for ReactJS
- vstack-router - Universal router
- redux-ecommerce - E-commerce flux with redux
- redux-form - An ES7 decorator for forms using Redux and React
- redux-form-validation - Form validation for controlled & uncontrolled inputs
- simple-redux-form - A tiny redux-form alternative Higher Order Component for forms.
- **https://github.com/calesce/redux-slider-monitor
- updeep - Easily update nested frozen objects and arrays in a declarative and immutable manner
- redux-immutable - Streamlines use of Immutable.js with Redux reducers.
- redux-import-export-monitor - A monitor for copying your serialized action log to the clipboard, as well as pasting it in from somewhere else
- icedam - Just-in-time immutability: freezes data sent to views.
- react-inline-grid - Predictable flexbox based grid for React using Redux and Immutable-js.
- redux-easy-actions - Sugar library for creating Redux or Flux actions
- redux-mount - Mount state data and change its state values on the fly
- redux-multi - Dispatch multiple actions from one action creator
- immu - A tiny, fail-fast, lazy, immutable Javascript objects library
- Generate standard action creators and reducers for CRUD applications
- Redux & ImmutableJs - Integration of Redux & ImmutableJs that 100% conforms Redux standards
- redux-tcomb - Immutable and type-checked state and actions for Redux
- redux-react-router-transitions - Attach react-router transitions to arbitrary actions
- redux-optimist - Optimistically apply actions that can be later commited or reverted.
- redux-devtools-diff-monitor - Redux DevTools – Diff Monitor
- redux-store-visualizer - Visualize Redux store in real time
- generator-redux - CLI tools for Redux: next-gen functional Flux/React with devtools
- generator-reactapp - Yeoman generator for react app with redux
- redux-viewmodel - ViewModel wrapping for Redux & React
- redux-utils - Utility functions for Redux
- multireducer - A utility to wrap many copies of a single Redux reducer into a single key-based reducer
- subdivide - User defined UI layout: Every pane can be subdivided and any widget assigned to any pane
- replux - Self contained components and enhancements for Redux
- redux-immutable-utils - Utilities for using Immutable with Redux
- recompose - A microcomponentization toolkit for React
- redux-lift - Lifting for Redux
- redux-router5 - router5 integration with Redux
- redux-devtools-extension - Redux DevTools Extension
- universal-redux-router - A very simple router for Redux and React that works on both server and client
- redux-watch - Watch/monitor for state changes on an object path
- redux-devtools-filterable-log-monitor - Filterable tree view monitor for Redux DevTools
- redux-flash-notification - A flash notification component for Redux
- redux-saga - An alternative side effect model for Redux apps
- remote-redux-devtools - Use Redux DevTools remotely for React Native, hybrid, desktop and server side Redux apps
- redux-devtools-dispatch - Dispatch your actions manually to test if your app reacts well
- redux-loop - Sequence your effects naturally and purely by returning them from your reducers
- redux-orm - A small, simple and immutable ORM to manage data in your Redux store
- redux-bacon - Utilities for attaching Bacon.js to Redux
- rereduce - Reducer library for Redux
- redux-decorators - A ridiculously good syntax for working with Redux and TypeScript. Currently limited to Angular 2 but could potentially be used elsewhere
- redux-test-reducer - Simple and clean testing mechanism for Redux reducers
- redux-devtools-inspector - Another Redux DevTools Monitor
- redux-ava - Helpers for writing Redux tests in AVA
- redux-cli - An opinionated CLI for building redux/react apps quicker
- redux-saga-rxjs - RxJS implementation of Saga pattern for redux
- redux-actions-assertions - Assertions for redux actions testing
- redux-duck - Helper function to create Redux modules using the ducks-modular-redux proposal
- redux-dispatch-cli - A CLI tool for Redux remote dispatch. Used in remote-redux-devtools
- redux-immutable-reducer - Immutable reducer states with Redux
- redux-bootstrap - configure React + React-Router + Redux + Immutable.js with one function!
- redux-director - Redux bindings to director router
- redux-q - Provides a way to queue callbacks until an action is dispatched
- Frameworks
- dva - Front-end framework based on react, redux, react-redux, react-router and redux-saga.
- Vdux - World's smallest framework. Stateless Virtual DOM <-> Redux
- Esex - Full-stack Universal JavaScript Framework (Redux+RxJs)
- Ripster
- Este - The most complete minimal dev stack / boilerplate for React & Redux universal web apps
- stardux - Functional DOM containers based on starplate, IncrementalDOM, and redux
- nux - A Push-Based Functional Reactive Web Application Framework
- Keo - Plain functions for a more functional Deku approach to creating React components, with functional goodies such as compose, memoize, etc... for free
- plait - A minimal JavaScript framework for building reactive web components
- reactuate — A React/Redux stack (not a boilerplate!) with a focus on Domain-Driven Design
- meatier - Like meteor, but meatier
- relax - New generation CMS on top of React, Redux and GraphQL
- lovli.js - A boilerplate for developing react+redux applications with rethinkdb/horizon as realtime database and express for the server
- kea - Well-readable, self-documenting and easily refactorable framework that brings your data to life! Comes with scaffolding tools 🐦
- Feeble - A framework built on top of React/Redux/redux-saga which aims to make building React/Redux applications easier and better.
- Conventional-Redux - A wrapper for react-redux which provides API based on convention over configuration pattern.
Similar libraries
- flux-ts - A small flux implementation heavily inspired by redux
- chopped-redux - A very small Flux implementation based on Redux
- fluxette - Minimalist, functional, and concise Flux
- rx-redux - A reimplementation of redux using RxJS
- understate - A simple state manager
- refer - Redux-like library for handling global state on functional style
- bobflux - Bobflux is pure functional implementation of FLUX pattern and is fitted to Bobril
- Examples
- Examples
- Examples
- Examples
- Examples
- Examples
- Examples
- Examples
Chrome Extensions
Ruby on Rails Resources
Other languages
- .NET
- Java
- https://github.com/glung/redux-java
- https://github.com/trikita/jedux
- https://github.com/izumin5210/Droidux
- Swift
- https://github.com/ReSwift/reduxSwift
- https://github.com/Swift-Flow/Swift-Flow
- https://github.com/ReSwift/ReSwift and docs
- Purescript
from https://github.com/xgrommx/awesome-redux
-----------------
Curated tutorial and resource links I've collected on React, Redux, ES6, and more.
React/Redux Links
Curated tutorial and resource links I've collected on React, Redux, ES6, and more, meant to be a collection of high-quality articles and resources for someone who wants to learn about the React-Redux ecosystem. Not quite "awesome", but hopefully useful as a starting point I can give to others. Suggestions welcome.
Another important resource is the Reactiflux community on Discord, which has chat channels dedicated to discussion of React, Redux, and other related technologies. There's always a number of people hanging out and answering questions, and it's a great place to ask questions and learn. The invite link is at https://www.reactiflux.com.
You might also want to check out my categorized list of Redux-related addons, libraries, and utilities, at Redux Ecosystem Links. Also see Community Resources for links to other links lists, podcasts, and email newsletters.
Table of Contents
Getting Started
- Basic Concepts and Overviews
- Community Resources
- Javascript Resources
- Git Resources and Tutorials
- Node.js and NPM
- Webpack Tutorials
- Boilerplates and Starter Kits
Basic Tutorials
Intermediate Concepts
Advanced Topics
- React Performance
- React/Redux Architecture
- React Styling
- Redux Side Effects
- Redux Tips and Techniques
- Webpack Advanced Techniques
Guidelines, Comparisons, and Discussion
- Thinking in React and Flux
- Tips, Guidelines, and Best Practices
- React/Flux/Redux Pros, Cons, and Discussion
- React and Flux vs Backbone
Best of the Best / Suggested Reading List
All of the links in this collection are worth reading, but there's obviously a LOT of them. Here's a "best-of" list to get you started:
- React How-To
https://github.com/petehunt/react-howto
Pete Hunt, one of React's creators, gives a high-level suggested order to use when learning React-related technologies (React, NPM, bundlers, ES6, routing, and Flux/Redux) - ES6 - The Bits You'll Actually Use
http://jamesknelson.com/es6-the-bits-youll-actually-use/
A quick tour through some of the more useful features in ES6 - ES6 Features Comparison
http://es6-features.org/
Code snippets comparing ES6 features with their ES5 equivalents - Webpack - The Module Bundler
http://alp82.github.io/webpack-experiment-slides/#/
HTML slideshow that describes Webpack's features and links to demos - React to the Future
http://elijahmanor.com/talks/react-to-the-future/dist/#/
A fantastic HTML slideshow describing what React is, what makes it special, and how to work with it - Relieving Backbone Pain with Flux & React
http://product.hubspot.com/blog/moving-backbone-to-flux-react
A fantastic video that walks through common problems with using Backbone, and how React can help solve those - Components, React, and Flux
http://slides.com/danabramov/components-react-flux-wip#/
A fantastic HTML slideshow that discusses how to organize code as reusable components, and the basic concepts and benefits of a Flux unidirectional architecture - Reactive, Component-Based UIs
http://banderson.github.io/reactive-component-ui-presentation/#/
Another fantastic HTML slideshow describing the three principles of React: "functional over OOP", "stateless over stateful", "clarity over brevity" (use arrow keys to advance slides) - Redux Docs
http://redux.js.org/index.html
The official Redux documentation. FANTASTIC writing - not just "here's the API", but "here's what you want to do and how we came up with this" - Managing Data Flow on the Client Side
http://blog.madewithlove.be/post/redux/
Walks through a small Redux example, and talks about the benefits - Pros and Cons of Using Immutability With React
http://reactkungfu.com/2015/08/pros-and-cons-of-using-immutability-with-react-js/
Excellent description of what immutability is, how to use it with React, and pros and cons of using it - React Best Practices and Tips
http://www.toptal.com/react/tips-and-practices
Several excellent guidelines for component structure and behavior - Redux Best Practices
https://medium.com/lexical-labs-engineering/redux-best-practices-64d59775802e
Guidelines for tools, component structure, file layout, and async data handling.
from https://github.com/markerikson/react-redux-links
------------------
------------------
Redux 中文文档 http://cn.redux.js.org/
README.md
在线 Gitbook 地址:http://cn.redux.js.org/
英文原版:http://redux.js.org/
学了这个还不尽兴?推荐极精简的 Redux Tutorial 教程
React 核心开发者写的 React 设计思想
Redux 是 JavaScript 状态容器,提供可预测化的状态管理。
可以让你构建一致化的应用,运行于不同的环境(客户端、服务器、原生应用),并且易于测试。不仅于此,它还提供 超爽的开发体验,比如有一个时间旅行调试器可以编辑后实时预览。
Redux 除了和 React 一起用外,还支持其它界面库。
它体小精悍(只有2kB)且没有任何依赖。
评价
Jing Chen,Flux 作者
Bill Fisher,Flux 作者
André Staltz,Cycle 作者
开发经历
Redux 的开发最早开始于我在准备 React Europe 演讲热加载与时间旅行的时候,当初的目标是创建一个状态管理库,来提供最简化 API,但同时做到行为的完全可预测,因此才得以实现日志打印,热加载,时间旅行,同构应用,录制和重放,而不需要任何开发参与。
启示
不管你有没有使用过它们,只需几分钟就能上手 Redux。
安装
安装稳定版:
npm install --save redux
npm install --save react-redux
npm install --save-dev redux-devtools
要点
应用中所有的 state 都以一个对象树的形式储存在一个单一的 store 中。
惟一改变 state 的办法是触发 action,一个描述发生什么的对象。
为了描述 action 如何改变 state 树,你需要编写 reducers。
就是这样!
import { createStore } from 'redux';
/**
* 这是一个 reducer,形式为 (state, action) => state 的纯函数。
* 描述了 action 如何把 state 转变成下一个 state。
*
* state 的形式取决于你,可以是基本类型、数组、对象、
* 甚至是 Immutable.js 生成的数据结构。惟一的要点是
* 当 state 变化时需要返回全新的对象,而不是修改传入的参数。
*
* 下面例子使用 `switch` 语句和字符串来做判断,但你可以写帮助类(helper)
* 根据不同的约定(如方法映射)来判断,只要适用你的项目即可。
*/
function counter(state = 0, action) {
switch (action.type) {
case 'INCREMENT':
return state + 1;
case 'DECREMENT':
return state - 1;
default:
return state;
}
}
// 创建 Redux store 来存放应用的状态。
// API 是 { subscribe, dispatch, getState }。
let store = createStore(counter);
// 可以手动订阅更新,也可以事件绑定到视图层。
store.subscribe(() =>
console.log(store.getState())
);
// 改变内部 state 惟一方法是 dispatch 一个 action。
// action 可以被序列化,用日记记录和储存下来,后期还可以以回放的方式执行
store.dispatch({ type: 'INCREMENT' });
// 1
store.dispatch({ type: 'INCREMENT' });
// 2
store.dispatch({ type: 'DECREMENT' });
// 1
你应该把要做的修改变成一个普通对象,这个对象被叫做 action,而不是直接修改 state。然后编写专门的函数来决定每个 action 如何改变应用的 state,这个函数被叫做 reducer。
如果你以前使用 Flux,那么你只需要注意一个重要的区别。Redux 没有 Dispatcher 且不支持多个 store。相反,只有一个单一的 store 和一个根级的 reduce 函数(reducer)。随着应用不断变大,你应该把根级的 reducer 拆成多个小的 reducers,分别独立地操作 state 树的不同部分,而不是添加新的 stores。这就像一个 React 应用只有一个根级的组件,这个根组件又由很多小组件构成。
用这个架构开发计数器有点杀鸡用牛刀,但它的美在于做复杂应用和庞大系统时优秀的扩展能力。由于它可以用 action 追溯应用的每一次修改,因此才有强大的开发工具。如录制用户会话并回放所有 action 来重现它。
文档
示例
如果你是 NPM 新手,创建和运行一个新的项目有难度,或者不知道上面的代码应该放到哪里使用,请下载 simplest-redux-example 这个示例,它是一个集成了 React、Browserify 和 Redux 的最简化的示例项目。
交流
打开 Slack,加入 Reactiflux 中的 #redux 频道。
感谢
- Elm 架构 介绍了使用 reducers 来操作 state 数据;
- Turning the database inside-out 大开脑洞;
- ClojureScript 里使用 Figwheel for convincing me that re-evaluation should “just work”;
- Webpack 热模块替换;
- Flummox 教我在 Flux 里去掉样板文件和单例对象;
- disto 演示使用热加载 Stores 的可行性;
- NuclearJS 证明这样的架构性能可以很好;
- Om 普及 state 惟一原子化的思想。
- Cycle 介绍了 function 是如何在很多场景都是最好的工具;
- React 实践启迪。
贡献者
定期更新,谢谢各位辛勤贡献
- Cam Song 会影@camsong
- Jovey Zheng@jovey-zheng
- Pandazki@pandazki
- Yuwei Wang@yuweiw823
- Desen Meng@demohi
- Arcthur@arcthur
- Doray Hong@dorayx
- Guo Cheng@guocheng
- omytea
- Fred Wang
- Amo Wu
- C. T. Lin
- 钱利江
- 云谦
- denvey
- 三点
- Eric Wong
- Owen Yang
- Cai Huanyu
本文档翻译流程符合 ETC 翻译规范.
from https://github.com/camsong/redux-in-chinese