📜  react hooks useeffect - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:07.590000             🧑  作者: Mango

代码示例6
jsximport { useEffect, useState } from 'react';function MyComponent({ prop }) {  const [state, setState] = useState('');  useEffect(() => {    // Runs ONCE after initial rendering    // and after every rendering ONLY IF `prop` or `state` changes  }, [prop, state]);}