react
文章平均质量分 50
牧羊狼爱学习
这个作者很懒,什么都没留下…
展开
-
redux-persist
【代码】redux-persist。原创 2024-04-12 15:54:26 · 237 阅读 · 0 评论 -
react-redux legacy_createStore
【代码】react-redux。原创 2023-08-06 16:09:17 · 720 阅读 · 0 评论 -
class类 与 react类组件的bind(this)
在 react 的类组件中,如果我们需要某个点击事件,通常会这样写: onClick={this.changeWeather}但为了能够使 changeWeather 方法中能够正确找到 this, 我们通常需要在constructor构造器中这样写:this.study = this.study.bind(this)为了能够比较好地解释清楚这个原理,我们先来回顾一下 es6 的 class:...............原创 2022-07-06 15:12:10 · 682 阅读 · 0 评论 -
redux-02 action
异步的 action方法一: 组件内写异步方法二:store中写npm install redux-thunkstore.js:count_action.js:count.jsx: 组件内调用:原创 2022-02-25 11:29:19 · 212 阅读 · 0 评论 -
redux-01
store.js:count_reducer.js:原创 2022-02-21 14:45:26 · 377 阅读 · 0 评论 -
react-router-dom 6版本
index.js:import App from './App'import ReactDOM from 'react-dom'import { BrowserRouter } from 'react-router-dom'ReactDOM.render( <BrowserRouter> <App /> </BrowserRouter>, document.getElementById('root'))App.js:impor原创 2022-02-16 18:34:05 · 705 阅读 · 0 评论 -
React 生命周期
挂载卸载:componentWillMount()componentDidMount()componentWillUnmount()【demo 演示】<script type="text/babel"> class Demo extends React.Component { constructor (props) { console.log('constructor') console.log('--------------...原创 2022-02-14 11:37:36 · 389 阅读 · 0 评论 -
React -- ref
RefsDemo 组件: 点击按钮后alert输入框中输入的值(需要用ref先获取到 input)写法一:String 类型 refs (过时API)<script type="text/babel"> class Demo extends React.Component { handleBtn = () => { alert(this.refs.inputRef.value) } render () { return (原创 2022-02-14 10:26:56 · 175 阅读 · 0 评论 -
React -- state props
引入 react 核心库:<script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script><script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script><script src="https://cdn.st原创 2022-02-12 20:36:51 · 378 阅读 · 0 评论