前端开发_8.React学习总结

一、参考链接:

ReactUI组件库:

React 教程:

路由、状态库:

React 案例参考学习:

  1. https://github.com/909652769/vite-react https://juejin.cn/post/7086024530560286734#heading-4
  2. https://github.com/Magiccwl/dzdp-react https://juejin.cn/post/6844903629619478536#heading-6
  3. https://juejin.cn/post/7108555432997683237
  4. https://juejin.cn/post/7169108697950453773

二、启动

//用cLl启动
npx create-react-app my-app
cd my-app
npm start
//JSX 表达式 props
const heading = <h1>Mozilla Developer Network</h1>;
<App subject="Clarice" />
function App(props) {
  const subject = "React";
  console.log(props);
  return (
    // return statement
  );
}
//state:
this.setState({comment: 'Hello'});
// Correct
this.setState((state, props) => ({
  counter: state.counter + props.increment
}));
//创建一个组件:
mkdir src/components
touch src/components/Todo.js
export default function Todo(props) {
    function HandleValue(e){
        e.preventDefault();
        console.log("zhouyaaaaaaaaaaaa");
    }
    return (
      <button onClick={HandleValue}>Button{props.name}</button>
    );
  }
import Todo from './components/Todo'
<Todo name="Eat" />
<Todo name="Sleep" />
<Todo name="Repeat" />
posted @ 2023-08-10 01:11  cactus9  阅读(13)  评论(0编辑  收藏  举报