Skip to content

Commit eeee9df

Browse files
committed
Breaking API changes for 1.0
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.
1 parent 7a90a53 commit eeee9df

File tree

10 files changed

+18
-11
lines changed

10 files changed

+18
-11
lines changed

counter/containers/App.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React from 'react';
22
import CounterApp from './CounterApp';
3-
import { createRedux } from 'redux';
3+
import { createStore } from 'redux/index';
44
import { Provider } from 'redux/react';
5-
import * as stores from '../stores';
5+
import * as reducers from '../reducers';
66

7-
const redux = createRedux(stores);
7+
const store = createStore(reducers);
88

99
export default class App {
1010
render() {
1111
return (
12-
<Provider redux={redux}>
12+
<Provider store={store}>
1313
{() => <CounterApp />}
1414
</Provider>
1515
);

counter/containers/CounterApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { bindActionCreators } from 'redux';
2+
import { bindActionCreators } from 'redux/index';
33
import { connect } from 'redux/react';
44
import Counter from '../components/Counter';
55
import * as CounterActions from '../actions/CounterActions';
File renamed without changes.
File renamed without changes.

counter/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module.exports = {
1818
new webpack.NoErrorsPlugin()
1919
],
2020
resolve: {
21+
alias: {
22+
'redux': path.join(__dirname, '../../src')
23+
},
2124
extensions: ['', '.js']
2225
},
2326
module: {

todomvc/containers/App.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import React from 'react';
22
import TodoApp from './TodoApp';
3-
import { createRedux } from 'redux';
3+
import { createStore, composeReducers } from 'redux/index';
44
import { Provider } from 'redux/react';
5-
import * as stores from '../stores';
5+
import * as reducers from '../reducers';
66

7-
const redux = createRedux(stores);
7+
const reducer = composeReducers(reducers);
8+
const store = createStore(reducer);
89

910
export default class App {
1011
render() {
1112
return (
12-
<Provider redux={redux}>
13-
{() => <TodoApp />}
13+
<Provider store={store}>
14+
{() => <TodoApp /> }
1415
</Provider>
1516
);
1617
}

todomvc/containers/TodoApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { bindActionCreators } from 'redux';
2+
import { bindActionCreators } from 'redux/index';
33
import { Connector } from 'redux/react';
44
import Header from '../components/Header';
55
import MainSection from '../components/MainSection';
File renamed without changes.
File renamed without changes.

todomvc/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module.exports = {
1818
new webpack.NoErrorsPlugin()
1919
],
2020
resolve: {
21+
alias: {
22+
'redux': path.join(__dirname, '../../src')
23+
},
2124
extensions: ['', '.js']
2225
},
2326
module: {

0 commit comments

Comments
 (0)