Skip to content

v2.0.0

Compare
Choose a tag to compare
@gaearon gaearon released this 19 Oct 16:35
· 53 commits to master since this release

Breaking Changes

React 0.14 is now required

We assume that your code doesn't have warnings on React 0.14.
For example, we won't handle ES6 classes that don't inherit from React.Component correctly.

createProxy() is now the default export

Before

import { createProxy } from 'react-proxy';

After

import createProxy from 'react-proxy';

getForceUpdate() is gone

Bye bye getForceUpdate(). We don't offer it anymore.
You should use react-deep-force-update directly now.

Before

import React from 'react';
import { getForceUpdate } from 'react-proxy';

const deepForceUpdate = getForceUpdate(React);

After

import deepForceUpdate from 'react-deep-force-update';

Proxy#update() no longer returns mounted instances

Now that’s a bummer! We know. Sadly there’s no way we can retrieve a list of mounted instances for the pure function components. For consistency, we don’t attempt to do this at all now. You are encourage to keep a reference to the root instance yourself, and use react-deep-force-update to update it when necessary. Hopefully we’ll resolve this eventually when React provides a first-class DevTools API for traversing the rendered tree.

Before

import { createProxy, getForceUpdate } from 'react-proxy';

const proxy = createProxy(ComponentVersion1);
const Proxy = proxy.get();

React.render(<Proxy />, rootEl);

const mountedInstances = proxy.update(ComponentVersion2);
const forceUpdate = getForceUpdate(React);
mountedInstances.forEach(forceUpdate);

After

import React from 'react';
import { render } from 'react-dom';
import createProxy from 'react-proxy';
import deepForceUpdate from 'react-deep-force-update';

const proxy = createProxy(ComponentVersion1);
const Proxy = proxy.get();

// You now have to keep a reference to the root instance.
const rootInstance = render(<Proxy />, rootEl);

proxy.update(ComponentVersion2);
deepForceUpdate(rootInstance);

Improvements

  • Adds support for React 0.14 pure function components