Hoist Non React Statics
hoist-non-react-statics
Copies non-react specific statics from a child component to a parent component
Utilities
react
hoist-non-react-statics
Utilities
javascript
npm
frontend
open source
ui
library
web
Stars
1.5k
Weekly
35M
Open issues
18
Bundle
~15 kB
Installation
npm install hoist-non-react-staticsCode example
import { useHoistNonReactStatics } from "hoist-non-react-statics";
export function Example() {
const value = useHoistNonReactStatics();
return <p>{String(value)}</p>;
}Pros & cons
Pros
- Actively maintained by Michael Ridgway
- 35M weekly downloads. Battle tested
- BSD-3-Clause licensed
Considerations
- Adds roughly ~15 kB to your bundle
- Needs client-only rendering in SSR frameworks
- Not supported in React Native
- 18 open issues on GitHub