首页 > TAG信息列表 > Reac

【reac学习t】react元素渲染

react元素 是一个对象 react 只有一个根节点。 react元素通过 ReactDOM.render()函数渲染到页面上 React元素不可变,要更新就要重新渲染。 React 元素可以用三种方式渲染   首先定一个挂在的div <div id="example”></div> 直接渲染        直接写一个element

[Reac] React 18

Replace Legacy Root API with New Root API ReactDOM.createRoot(document.getElementById("root")).render(<App />);   Use React 18's New Root API Alongside the Legacy Root API Behavior of each type of API for React 17 and 18: let root1

reac中useCallback使用

import React,{useState,useCallback} from "react" const Son = React.memo( ({a,c}) =>{ console.log('son 重新渲染'); return ( <div> a:{a} <button onClick={c}>点击</button> <