react生命周期

import { useMount,useUnmount,useReactive ,useUpdateEffect} from "ahooks";
import styled from "styled-components";
import {useEffect, useState} from 'react'
export default  Model2 = ({attr,getData}) => {//父级属性,方法
  
  const state = useReactive({ //直接更改
    name:null
  })
  const [pages, setPages] = useState({ //set方法修改
    current: 1,
    limit: 10
  })
  useEffect(() => {
   
  }, [pages.current, pages.limit])
  useUpdateEffect(() => {
   
  }, [pages.current, pages.limit])//会忽略首次执行,只在依赖更新时执行
  useMount(() => {
    
  })
  useUnmount(() => {
   
  })
  
  
  return (
    
  )
}
const Style = styled.div`
  width: 80%;
 
`;

你可能感兴趣的:(前端,react.js,前端,javascript)