Skip to content

v1.0.0-beta-1

Latest
Compare
Choose a tag to compare
@roderickhsiao roderickhsiao released this 29 Apr 20:29
· 6 commits to main since this release
147f736

What's Changed

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

  1. 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.
  2. Class Component Migration: We recommend migrating away from class-based components when possible due to these changes affecting ref handling.
  3. Ref Propagation: Both class and functional components must now use forwardedRef to directly attach refs to the HTML DOM elements to ensure proper registration.
  4. 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