|
1
|
function Component(props) { |
|
2
|
const ref = useRef(null); |
|
3
|
useEffect(() => { |
|
4
|
const el = ref.current; |
|
5
|
if (el) { |
|
6
|
init(el, props.data); |
|
7
|
} |
|
8
|
function init(el, data) { |
|
9
|
const init = makeInit(data); |
|
10
|
init.start(); |
|
11
|
} |
|
12
|
}); |
|
13
|
return <div ref={ref} />; |
|
14
|
} |