@2890594972
2019-05-17T07:16:49.000000Z
字数 1633
阅读 826
react入门到精通 react

组件状态有两种:注意:props用来传值, state用来维护数据


SnippetsBelow is a list of all available snippets and the triggers of each one. The ⇥ means the TAB key.Trigger Contentrcc→ class component skeletonrrc→ class component skeleton with react-redux connectrrdc→ class component skeleton with react-redux connect and dispatchrccp→ class component skeleton with prop types after the classrcjc→ class component skeleton without import and default export linesrcfc→ class component skeleton that contains all the lifecycle methodsrwwd→ class component without import statementsrpc→ class pure component skeleton with prop types after the classrsc→ stateless component skeletonrscp→ stateless component with prop types skeletonrsf→ stateless named function skeletonrsfp→ stateless named function with prop types skeletonrsi→ stateless component with prop types and implicit returnfcc→ class component with flow types skeletonfsf→ stateless named function skeleton with flow types skeletonfsc→ stateless component with flow types skeletonrpt→ empty propTypes declarationrdp→ empty defaultProps declarationcon→ class default constructor with propsconc→ class default constructor with props and contextest→ empty state objectcwm→ componentWillMount methodcdm→ componentDidMount methodcwr→ componentWillReceiveProps methodscu→ shouldComponentUpdate methodcwup→ componentWillUpdate methodcdup→ componentDidUpdate methodcwun→ componentWillUnmount methodgsbu→ getSnapshotBeforeUpdate methodgdsfp→ static getDerivedStateFromProps methodcdc→ componentDidCatch methodren→ render methodsst→ this.setState with object as parameterssf→ this.setState with function as parameterprops→ this.propsstate→ this.statebnd→ binds the this of method inside the constructordisp→ MapDispatchToProps redux function
