mongodb-js / connect-backbone-to-react

Connect Backbone Models and Collections to React.
https://www.npmjs.com/package/connect-backbone-to-react
Apache License 2.0
27 stars 5 forks source link

Avoid strict mode deprecation errors #25

Closed jetpacmonkey closed 4 years ago

jetpacmonkey commented 4 years ago

This switches to using the new context API (along with a peerDependency bump to React 16.6 in order to get support for the contextType field), and removes any use of deprecated methods. While removing componentWillReceiveProps calls, I eventually just had it generate the props to pass down during render instead of storing them in state as an intermediary, and used forceUpdate instead of setState calls when the backbone model had a change event. There were a few tests that were spying directly on the setState call, so I had to tweak those, but otherwise all of the functionality seems to be intact. The one thing that I'm not sure about is if this is going to cause any performance regressions, but it felt like it was ready for an initial review, at least.

Resolves #23