📌  相关文章
📜  react useEffect - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:31.128000             🧑  作者: Mango

代码示例6
import React, { useState, useEffect } from 'react';

function Example() {
  const [count, setCount] = useState(0);
  
  // Similar to componentDidMount and componentDidUpdate:  
  useEffect(() => {    
    // Update the document title using the browser API    
    document.title = `You clicked ${count} times`;  
  });
  
  return (
    

You clicked {count} times

); }