Skip to content

Commit 5e7512a

Browse files
committed
Remove provide and Connector from public API
1 parent 11adf72 commit 5e7512a

File tree

9 files changed

+28
-151
lines changed

9 files changed

+28
-151
lines changed

README.md

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@ For React Native, import from `react-redux/native` instead.
99
>**Note: There is a project called “redux-react” on NPM that is completely unrelated to the official bindings. This documentation (and any other official Redux documentation) is for `react-redux`.**
1010
1111
- [Quick Start](#quick-start)
12-
- [Recommended API](#recommended-api)
12+
- [API](#api)
1313
- [`connect`](#connect)
1414
- [`Provider`](#provider)
15-
- [Deprecated API](#deprecated-api)
16-
- [`Connector`](#connector)
17-
- [`provide`](#provide)
1815

1916
## Quick Start
2017

@@ -214,7 +211,7 @@ React.render((
214211
// );
215212
```
216213

217-
## Recommended API
214+
## API
218215

219216
### `connect`
220217

@@ -246,42 +243,7 @@ See the usage example in the quick start above.
246243

247244
The `Provider` component takes a `store` prop and a [function as a child](#child-must-be-a-function) with your root
248245
component. The `store` is then passed to the child via React's `context`. This is the entry point for Redux and must be
249-
present in order to use the `Connector` component.
250-
251-
## Deprecated API
252-
253-
### `Connector`
254-
255-
>**Note**
256-
>Deprecated. Use `connect()` instead.
257-
258-
```js
259-
<Connector select={fn}>
260-
{props => <MyComponent {...props} />}
261-
</Connector>
262-
```
263-
264-
Similar to `Provider`, the `Connector` expects a single [function as a child](#child-must-be-a-function) and a function
265-
as the `select` prop. The selector function takes a single argument of the entire root store and returns an object to be
266-
passed as properties to the child. In addition to the properties returned by the selector, a `dispatch` function is
267-
passed to the child for dispatching actions.
268-
269-
It is the responsibility of a Smart Component to bind action creators to the given `dispatch` function and pass those
270-
bound creators to Dumb Components. Redux provides a `bindActionCreators` to streamline the process of binding action
271-
creators to the dispatch function.
272-
273-
We don’t recommend its use anymore because it’s not as flexible as `connect()` and has some performance implications for more complex scenarios.
274-
275-
### `provide`
276-
277-
>**Note**
278-
>Deprecated. Use `<Provider>` instead.
279-
280-
```js
281-
export default provide(store)(MyRootComponent);
282-
```
283-
284-
This higher-order component provides the same functionality as `<Provider>`. We don’t recommend it anymore because it’s less flexible than `<Provider>` and doesn’t work with [redux-devtools](http://github.com/gaearon/redux-devtools) or server rendering.
246+
present in order to use the `connect` component.
285247

286248
## License
287249

src/components/createAll.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
import createProvider from './createProvider';
2-
import createProvideDecorator from './createProvideDecorator';
32

43
import createConnector from './createConnector';
54
import createConnectDecorator from './createConnectDecorator';
65

76
export default function createAll(React) {
8-
// Wrapper components
97
const Provider = createProvider(React);
10-
const Connector = createConnector(React);
8+
const connect = createConnectDecorator(React, createConnector(React));
119

12-
// Higher-order components (decorators)
13-
const provide = createProvideDecorator(React, Provider);
14-
const connect = createConnectDecorator(React, Connector);
15-
16-
return { Provider, Connector, provide, connect };
10+
// provider and Connector are deprecated and removed from public API
11+
return { Provider, connect };
1712
}

src/components/createConnector.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import shallowEqual from '../utils/shallowEqual';
33
import isPlainObject from '../utils/isPlainObject';
44
import invariant from 'invariant';
55

6+
// Connector is deprecated and removed from public API
67
export default function createConnector(React) {
78
const { Component, PropTypes } = React;
89
const storeShape = createStoreShape(PropTypes);

src/components/createProvideDecorator.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
22
import createAll from './components/createAll';
33

4-
export const { Provider, Connector, provide, connect } = createAll(React);
4+
// provide and Connector are deprecated and removed from public API
5+
export const { Provider, connect } = createAll(React);

src/native.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react-native';
22
import createAll from './components/createAll';
33

4-
export const { Provider, Connector, provide, connect } = createAll(React);
4+
// provide and Connector are deprecated and removed from public API
5+
export const { Provider, connect } = createAll(React);

test/components/Connector.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import expect from 'expect';
22
import jsdomReact from './jsdomReact';
33
import React, { PropTypes, Component } from 'react/addons';
44
import { createStore } from 'redux';
5-
import { Connector } from '../../src/index';
5+
import createConnector from '../../src/components/createConnector';
66

7+
const Connector = createConnector(React);
78
const { TestUtils } = React.addons;
89

910
describe('React', () => {

test/components/connect.spec.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import expect from 'expect';
22
import jsdomReact from './jsdomReact';
33
import React, { PropTypes, Component } from 'react/addons';
44
import { createStore } from 'redux';
5-
import { connect, Connector } from '../../src/index';
5+
import { connect } from '../../src/index';
66

77
const { TestUtils } = React.addons;
88

@@ -45,9 +45,11 @@ describe('React', () => {
4545
const div = TestUtils.findRenderedDOMComponentWithTag(container, 'div');
4646
expect(div.props.pass).toEqual('through');
4747
expect(div.props.foo).toEqual('bar');
48-
expect(() =>
49-
TestUtils.findRenderedComponentWithType(container, Connector)
50-
).toNotThrow();
48+
49+
// Connector is deprecated and removed from public API
50+
// expect(() =>
51+
// TestUtils.findRenderedComponentWithType(container, Connector)
52+
// ).toNotThrow();
5153
});
5254

5355
it('should handle additional prop changes in addition to slice', () => {
@@ -118,13 +120,15 @@ describe('React', () => {
118120
{() => <Container pass='through' />}
119121
</Provider>
120122
);
121-
const connector = TestUtils.findRenderedComponentWithType(container, Connector);
122-
expect(connector.props.select({
123-
foo: 5,
124-
bar: 7
125-
})).toEqual({
126-
foo: 5
127-
});
123+
124+
// Connector is deprecated and removed from public API
125+
// const connector = TestUtils.findRenderedComponentWithType(container, Connector);
126+
// expect(connector.props.select({
127+
// foo: 5,
128+
// bar: 7
129+
// })).toEqual({
130+
// foo: 5
131+
// });
128132
});
129133

130134
it('should set the displayName correctly', () => {

test/components/provide.spec.js

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)