diff --git a/CHANGELOG.md b/CHANGELOG.md index 28a4c1b..7103a18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 3.1.0 +* Use `UNSAFE_` prefix for `componentWillMount`, `componentWillReceiveProps` usages in `connect` HOC. + ## 3.0.1 * Externalize `hoist-non-react-statics` from CJS and ESM bundles. diff --git a/package.json b/package.json index c465efb..5ae6d89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "general-store", - "version": "3.0.1", + "version": "3.1.0", "description": "Simple, flexible store implementation for Flux.", "main": "lib/GeneralStore.js", "scripts": { diff --git a/src/dependencies/__tests__/connect-test.js b/src/dependencies/__tests__/connect-test.js index 5748df0..47757e0 100644 --- a/src/dependencies/__tests__/connect-test.js +++ b/src/dependencies/__tests__/connect-test.js @@ -112,7 +112,7 @@ describe('connect', () => { }); }); - describe('componentWillMount', () => { + describe('UNSAFE_componentWillMount', () => { it('registers a callback with the dispatcher', () => { shallow(); expect(dispatcher.register.mock.calls.length).toEqual(3); @@ -128,7 +128,7 @@ describe('connect', () => { }); }); - describe('componentWillReceiveProps', () => { + describe('UNSAFE_componentWillReceiveProps', () => { it('calculates and sets state', () => { const root = shallow(); root.setProps({ add: 2 }); diff --git a/src/dependencies/connect.tsx b/src/dependencies/connect.tsx index 5c7c603..0fc8dec 100644 --- a/src/dependencies/connect.tsx +++ b/src/dependencies/connect.tsx @@ -41,7 +41,7 @@ export default function connect( state: any = {}; wrappedInstance?: HTMLElement = null; - componentWillMount() { + UNSAFE_componentWillMount() { if (dispatcher) { this.dispatchToken = dispatcher.register( handleDispatch.bind( @@ -55,7 +55,7 @@ export default function connect( this.setState(calculateInitial(dependencies, this.props, this.state)); } - componentWillReceiveProps(nextProps: Object) { + UNSAFE_componentWillReceiveProps(nextProps: Object) { this.setState( calculateForPropsChange(dependencies, nextProps, this.state) );