Skip to content

Commit

Permalink
Breaking API changes for 1.0
Browse files Browse the repository at this point in the history
Naming:

* “Stateless Stores” are now called reducers. (reduxjs/redux#137 (comment))
* The “Redux instance” is now called “The Store”. (reduxjs/redux#137 (comment))
* The dispatcher is removed completely. (reduxjs/redux#166 (comment))

API changes:

* <s>`composeStores`</s> is now `composeReducers`.
* <s>`createDispatcher`</s> is gone.
* <s>`createRedux`</s> is now `createStore`.
* `<Provider>` now accepts `store` prop instead of <s>`redux`</s>.
* The new `createStore` signature is `createStore(reducer: Function | Object, initialState: any, middlewares: Array | ({ getState, dispatch }) => Array)`.
* If the first argument to `createStore` is an object, `composeReducers` is automatically applied to it.
* The “smart” middleware signature changed. It now accepts an object instead of a single `getState` function. The `dispatch` function lets you “recurse” the middleware chain and is useful for async: reduxjs/redux#113 (comment).

Correctness changes:

* The `dispatch` provided by the default thunk middleware now walks the whole middleware chain.
* It is enforced now that raw Actions at the end of the middleware chain have to be plain objects.
* Nested dispatches are now handled gracefully. (reduxjs/redux#110)

Internal changes:

* The object in React context is renamed from <s>`redux`</s> to `store`.
* Some tests are rewritten for clarity, focus and edge cases.
* Redux in examples is now aliased to the source code for easier work on master.
  • Loading branch information
gaearon committed Jun 30, 2015
1 parent feccbcb commit a473076
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
11 changes: 6 additions & 5 deletions containers/App.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import React from 'react';
import TodoApp from './TodoApp';
import { createRedux } from 'redux';
import { createStore, composeReducers } from 'redux/index';
import { Provider } from 'redux/react';
import * as stores from '../stores';
import * as reducers from '../reducers';

const redux = createRedux(stores);
const reducer = composeReducers(reducers);
const store = createStore(reducer);

export default class App {
render() {
return (
<Provider redux={redux}>
{() => <TodoApp />}
<Provider store={store}>
{() => <TodoApp /> }
</Provider>
);
}
Expand Down
2 changes: 1 addition & 1 deletion containers/TodoApp.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { bindActionCreators } from 'redux';
import { bindActionCreators } from 'redux/index';
import { Connector } from 'redux/react';
import Header from '../components/Header';
import MainSection from '../components/MainSection';
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module.exports = {
new webpack.NoErrorsPlugin()
],
resolve: {
alias: {
'redux': path.join(__dirname, '../../src')
},
extensions: ['', '.js']
},
module: {
Expand Down

0 comments on commit a473076

Please sign in to comment.