Releases: NightCafeStudio/react-render-if-visible
Releases · NightCafeStudio/react-render-if-visible
v2.1.1
v2.1.0
v2.0.2
Potentially breaking change - SSR
In v1.x, the component detected when it was being rendered on the server, and set the initial visible state to true. To work with server-side rendering in React 17+, we no-longer detect the server from within the component, but a new prop initialVisible
is exposed which allows you to control whether the child component should be visible on first render or not. This is intended to be used for things like always rendering the first N components as visible, and the rest as not visible (until they're scrolled into view).
Other changes in v2
- Works with React 17 and 18
- A new prop -
stayRendered
(thanks to cyremur) that will keep the element visible after it's been rendered for the first time - New props allow you to specify the type of root and placeholder elements (in versions 1.x they were always divs), which allows you to use this package inside tables, etc