preact-deep-force-update
v0.1.0
Published
Recursively invoke forceUpdate() on a tree of components.
Downloads
11
Readme
preact-deep-force-update
Recursively invoke forceUpdate() on a tree of components.
JSFiddle Example
Usage Example
import { h, Component, render } from 'preact';
import deepForceUpdate from 'preact-deep-force-update';
class Main extends Component {
render() {
return <div><Inner /></div>;
}
}
class Inner extends Component {
render() {
let time = new Date().toTimeString();
return <span>{time}</span>;
}
}
let main;
render(<Main ref={c => main=c } />, document.body);
// force an update to the whole tree:
deepForceUpdate(main);
// you can also pass an Element:
deepForceUpdate(document.body.firstChild);