美文网首页
React Notes

React Notes

作者: 卤豆干HelloWorld | 来源:发表于2017-11-04 12:59 被阅读0次

General:

github.com/stephengrider
project link: https://github.com/StephenGrider/ReduxCasts

Screen Shot 2017-11-03 at 11.31.26 AM.png

1.

1.1JSX
1.2 state
two kinds of component:

  • functional component
  • class component - this one has state property.

1.3 classes
1.4 Arrow functions

2. Redux

Screen Shot 2017-11-06 at 9.17.26 AM.png
Redux is the data contained inside the application box.
React is really the views contained

2.1 State vs Prop
state: changes in the internal value, did not change the rest of the app
prop: injected into other components

function mapStateToProps(state) {
  //whatever is returned will show up as props inside
  return {
  asdf: '123' 
 };
}

component state is different from the application state

2.2
Component

import React from 'react';
import ReactDOM from 'react-dom';
//functional component
const SearchBar = () =>{
  return <input />;
};


//class based component
import React, {Component} from 'react';

class SearchBar extends Component {
  render(){
   return <input />; 
  }
}

export default SearchBar

2.3 State

import React, {Component} from 'react';

class SearchBar extends Component {
 constructor(props){
  super(props)
 };
 this.state = {term: ''};
}

render() {
 return <input onChange = {event => console.log(event.target.value)} />;
}

export default SearchBar;

相关文章

  • React Study Notes

    This is the React study notes I made when I started to le...

  • React Notes

    When using a pure component, pay special attention to arr...

  • React Notes

    General: github.com/stephengriderproject link: https://gi...

  • 从代码实践潜入react内部,深入diff

    原文: Implementation Notes原译文: react的实现记录 本节是 stack reconci...

  • Notes On React - Three

    事件处理   React 中事件绑定属性的命名采用驼峰命名,且采用了 JSX 语法的时候需要传递一个函数作为时间处...

  • Notes On React - One

    安装   React依赖于react、react-dom这两个包。生成React项目可以通过包管理工具(如npm)...

  • Notes On React - Four

    Refs   在一般情况下,props 是父组件与子组件交互的唯一方式-传入新的 props 来重新渲染子组件。 ...

  • Notes On React - Two

    React 的生命周期   React组件 的生命周期大致可分成四个状态:  - Mounting:装配-组件实例...

  • react婴儿_notes

    视频地址: https://haoqicat.com/react-baby/1-react-show第二版:htt...

  • react bug notes

    Objects are not valid as a React child (found: object wit...

网友评论

      本文标题:React Notes

      本文链接:https://www.haomeiwen.com/subject/rawxmxtx.html