随笔分类 - React
摘要:import React, { Component, useContext, useState } from 'react'; // 解构写法 const { Provider, Consumer } = React.createContext(); // defaultValue的问题 // ht
阅读全文
摘要:// 函数组件使用forwardRef传递ref const ForwardRefComponent = React.forwardRef((props, ref) => <div ref={ref.bind(this)} {...props}>子组件DOM</div>) export defaul
阅读全文
摘要:React 通过ref获取DOM对象或者子组件实例的用法 https://www.cnblogs.com/greatdesert/p/12697726.html React 通过forwardRef获取函数组件内某个DOM节点或者子组件的实例 https://www.cnblogs.com/grea
阅读全文
摘要:section 1 //react组件 export class Halo extends React.Component{ constructor(...args){ super(...args); //初始化父类构造函数 this.state={ //设置state text:"" } } he
阅读全文
摘要:https://itbilu.com/javascript/react/4k5RfzDKx.html
阅读全文