@hookers/use-wait-for-element
v1.0.2
Published
__requires react 16.8+__
Downloads
1
Readme
@hookers/use-wait-for-element
requires react 16.8+
Wait for a dom element to appear then execute a callback
install
yarn add @hookers/use-wait-for-element
import { useWaitForElement } from '@hookers/use-wait-for-element';
const onClick = () => {
const demo = document.createElement('div');
demo.id = 'demoId';
document.body.appendChild(demo);
}
export const Example: React.FC = () => {
useWaitForElement('#demoId', () => aleart('callback!'));
return <button onClick={onClick}>Click me</button>;
}