首页 > Windows开发 > 详细

一、基础知识 React API 一览

时间:2019-06-23 12:46:21      阅读:100      评论:0      收藏:0      [点我收藏+]

1.10 Hooks

参考文章:https://juejin.im/post/5be3ea136fb9a049f9121014

demo:

/**
 * 必须要react和react-dom 16.7以上
 */

import React, { useState, useEffect } from ‘react‘

export default () => {
  const [name, setName] = useState(‘jokcy‘)

  useEffect(() => {
    console.log(‘component update‘)

    return () => {
      console.log(‘unbind‘)
    }
  }, [])

  return (
    <>
      <p>My Name is: {name}</p>
      <input type="text" value={name} onChange={e => setName(e.target.value)} />
    </>
  )
}

1.11 React.children

 

一、基础知识 React API 一览

原文:https://www.cnblogs.com/QianDingwei/p/11072363.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!