const App = ({todos, actions}) => ( <div> <Header addTodo={actions.addTodo} aaa/> <MainSection todos={todos} actions={actions} /> </div>)
这是父组件,里面有个Header
是自定义组件,其中有个自定义属性是aaa
.
这个aaa
是我随手写的,也未在其他地方声明过。
然后我在Header
里面,console.log
出aaa
,为啥是个true?
export default class Header extends Component { static propTypes = { addTodo: PropTypes.func.isRequired } render() { console.log(this.props)//值为Object {aaa: true} return ( <header className="header"> <h1>todos</h1> <TodoTextInput newTodo placeholder="What needs to be done?" /> </header> ) } }
饮歌长啸
相关分类