随笔分类 - react
摘要:// 路由懒加载 yarn add react-loadable 1 loadable.js import React from 'react'; import Loadable from 'react-loadable'; const LoadableComponent = Loadable({
阅读全文
摘要:Fragment 占位符标签 使用方法 class => className className="input" {/* 注释内容 */}// 注释内容 dangerouslySetInnerHTML={{__html:item}} 可以解析 html 标签 <li key={item} onCli
阅读全文
摘要:import React,{useState} from 'react' export default function ComplexHookState() { const [friends, setFriends] = useState(['李雷','科比']) const [students,
阅读全文
摘要:yarn add antdyarn add @ant-design/iconsyarn add moment // 配置andt 主题yarn add @craco/craco// 修改配置命令 "scripts": { "start": "craco start", "build": "craco
阅读全文
摘要:import React, { PureComponent } from 'react' // yarn add classnames import classNames from 'classnames' export default class app extends PureComponent
阅读全文
摘要:yarn add styled-components 1 import styled from 'styled-components' export const HomeWrapper = styled.div ` font-size:20px; color:red; .banner{ backgr
阅读全文
摘要:import React, { PureComponent } from 'react' function withRenderTime(WrappedComponent){ return class extends PureComponent{ componentWillMount() { thi
阅读全文
摘要:import React, { PureComponent } from 'react' // class LoginPage extends PureComponent { render() { return ( <div> <h2>LoginPage</h2> </div> ) } } func
阅读全文
摘要:import React, { PureComponent, createContext } from 'react' import { render } from 'react-dom' // 定义一个高阶组件 function withUser(WrappedComponent){ return
阅读全文
摘要:import React, { PureComponent } from 'react' // 定义一个高阶组件 function enhanceRegionProps(WrappedComponent){ return props => { return <WrappedComponent {..
阅读全文
摘要:import React, { PureComponent,createRef } from 'react' export default class App extends PureComponent { constructor(props){ super(props) this.username
阅读全文
摘要:import React, { PureComponent } from 'react' export default class App extends PureComponent { constructor(props){ super(props) this.state = { username
阅读全文
摘要:import React, { PureComponent,createRef } from 'react' class Counter extends PureComponent { constructor(props){ super(props) this.state = { counter:0
阅读全文
摘要:import React, { PureComponent } from 'react' import {EventEmitter} from 'events'; // yarn add events // 事件总线 event bus const eventBus = new EventEmitt
阅读全文
摘要:import React, { PureComponent } from 'react' export default class App extends PureComponent { constructor(props){ super(props) this.state = { friends:
阅读全文
摘要:import React, { Component } from 'react' export default class App extends Component { constructor(props){ super(props) this.state = { counter:0, name:
阅读全文
摘要:import React, { Component } from 'react' export default class App extends Component { constructor(props){ super(props) this.state = { counter:0 } } re
阅读全文
摘要:import React, { Component } from 'react' export default class App extends Component { constructor(props){ super(props) this.state = { counter:0 } } re
阅读全文
摘要:import React, { Component } from 'react' const userContext = React.createContext({ nickname:'AAA', level:0 }) class ProfileHeader extends Component{ r
阅读全文
摘要:import React, { Component } from 'react' // props 从上向下一层一层传递 function ProfileHeader(props){ console.log(props); return ( <div> <h2>用户昵称: {props.nickna
阅读全文

浙公网安备 33010602011771号