Skip to content

breaking(Transition): Only call findDOMNode if necessary #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 11, 2019

Conversation

eps1lon
Copy link
Owner

@eps1lon eps1lon commented Apr 11, 2019

Cherry-picking reactjs#468

Breaking

Callbacks that use argument spread or access arguments will not have acces to the DOM node. The DOM node is only passed if Function.prototype.length is greater than 0.

// no node passed
const noNodeCallback = () => {};
// node passed
const withNodeCallback = node => {};

The first callback enables strict mode compatible usage of Transition. If you expect the node in callbacks a call to findDOMNode is required which issues a warning in React.StrictMode.

@eps1lon eps1lon added enhancement New feature or request SemVer: Breaking labels Apr 11, 2019
@eps1lon eps1lon changed the title Feat/unnecessary find dom node breaking(Transition): Only call findDOMNode if necessary Apr 11, 2019
@eps1lon eps1lon merged commit e58ed36 into strict Apr 11, 2019
eps1lon added a commit that referenced this pull request Jun 19, 2019
* feat(Transition): Add findDOMNode prop

Useful for strict mode compatibility.

* test(Transition): Add test case for default findDOMNode

* test(Transition): Use jest.fn instead of sinon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SemVer: Breaking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant