react-ignore-render
v2.0.1
Published
IgnoreRender is a React component to ignore renders
Downloads
9
Readme
IgnoreRender is a React component to ignore renders.
- ::sunrise:: There is a first render regardless of the
ignore
value. - :large_blue_circle: If
ignore
isfalse
, it works as usual. - :red_circle: If
ignore
istrue
, everything inside IgnoreRender will NOT be rendered with the current data. - :recycle: If
ignore
changes fromfalse
totrue
, everything inside IgnoreRender will be rendered with the current data. Even if you called thesetState
at a time when the value ofignore
was equal totrue
.
Example
<div>1</div>
will always be there as long as ignore={true}
import IgnoreRender from 'react-ignore-render'
export default function MyComponent() {
const [second, setSecond] = useState(1)
useEffect(() => {
setSecond(2)
}, [])
return (
<IgnoreRender ignore={true}>
{() => (
<div>
{second}
</div>
)}
</IgnoreRender>
)
}