摘要:
npx create-react-app my-app cd my-app npm start 添加路由库 react-router-dom npm i react-router-dom package.js name:项目名称 version:项目版号 private:项目是否开源 depende 阅读全文
posted @ 2022-11-18 17:28
Cherishe
阅读(24)
评论(0)
推荐(0)
摘要:
第零步:导入 import React,{useState,useEffect} from "react" 第一步: 创建函数组件: export default function Banner(){ 第二步: 改变状态: const [n,setN] = useState(0)//改变数值 con 阅读全文
posted @ 2022-11-18 16:55
Cherishe
阅读(65)
评论(0)
推荐(0)
摘要:
// 导入 import React,{} from "react" //使用:基本结构 export default class Banner extends React.Component{ //状态: constructor(){ super(); this.state={ //写数据 } } 阅读全文
posted @ 2022-11-18 13:44
Cherishe
阅读(54)
评论(0)
推荐(1)
摘要:
Effect Hook: 函数组件执行副作用操作 函数组件+hook import React,{useEffect,useState} from "react" export default function Hook(){ //状态:(声明) const [count,setCount] = u 阅读全文
posted @ 2022-11-18 12:43
Cherishe
阅读(18)
评论(0)
推荐(0)
摘要:
hook: 特殊的函数 hook作用: 钩入react的特性 useState: 函数组件添加state的hook hook的声明: 类组件: default export class Hook extends react.Component{ //在这里写状态: constructor(){ su 阅读全文
posted @ 2022-11-18 12:16
Cherishe
阅读(117)
评论(0)
推荐(0)

浙公网安备 33010602011771号