v1.0.0-beta-1
roderickhsiao
released this
29 Apr 20:29
·
21 commits
to main
since this release
What's Changed
- Bump tough-cookie from 4.1.2 to 4.1.3 by @dependabot in #121
- Bump semver from 5.7.1 to 5.7.2 by @dependabot in #122
- Bump word-wrap from 1.2.3 to 1.2.4 by @dependabot in #123
- Bump react-aspect-ratio to support passing refs by @chrissantamaria in #120
- fix: Remove findDOMNode from libary by @roderickhsiao in #125
Breaking Change Announcement
We are deprecating the use of findDOMNode
due to its removal in React's future releases. This change involves shifting the responsibility of accessing the DOM node directly to the component owner. This update affects our HOC implementations and the way refs are handled in both functional and class-based components.
fix #73
What's Breaking
- HOC Ref Handling: For enhanced compatibility with both functional and class-based components, HOCs will now return a ReactNode instead of a DOMNode. This change means you must use forwardedRef to attach refs directly to the DOM elements within your components.
- Class Component Migration: We recommend migrating away from class-based components when possible due to these changes affecting ref handling.
- Ref Propagation: Both class and functional components must now use forwardedRef to directly attach refs to the HTML DOM elements to ensure proper registration.
- Hook Update: The useInViewport hook now requires a DOM node to be passed explicitly.
Migration Guide
To adapt to these changes, you'll need to update how refs are passed and used within your components. Below are the examples illustrating the necessary updates:
Before
class A {
render() {
return (
<div />
)
}
}
After
class A {
render() {
return (
<div ref={this.props.forwardedRef}/>
)
}
}
Full Changelog: v1.0.0-alpha.30...v1.0.0-beta-1