import React,{ Component } from 'react';
class SearchBar extends Component {
constructor(props){
super(props);
this.state = {term : ''};
}
render() {
return <input onChange={event => this.setState( { term:event.target.value } )} />;
}
}
export default SearchBar;
这里的props指的是什么?怎么理解?
这是一个属性的集合,元素为当前组件的所有属性的键值对
例如你在渲染组件时使用这样语法:
那么props就是: