10 2023 档案
摘要:// 子组件 nav.js import React, { useRef, useEffect, useState, useLayoutEffect } from "react"; import './nav.less' function Nav({items}) { const ref = use
阅读全文
摘要:块语句(大括号“{}”中间的语句),如 if 和 switch 条件语句或 for 和 while 循环语句,不像函数,它们不会创建一个新的作用域。在块语句中定义的变量将保留在它们已经存在的作用域中。 if (true) { // 'if' 条件语句块不会创建一个新的作用域 var name = '
阅读全文
摘要:使用函数式更新的方法实现定时器的代码: import React, { useState, useEffect } from 'react'; function App() { const [count, setCount] = useState(0); useEffect(() => { cons
阅读全文
摘要:const themes = { default: { backgroundColor: 'white', textColor: 'black', fontSize: '16px', }, dark: { backgroundColor: 'black', textColor: 'white', f
阅读全文
摘要:#方法一: 同端口,不同路径#nginx清空代理末尾加/.#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log
阅读全文