Benjamin Li Benjamin Li - 1 month ago 27
React JSX Question

In React with Redux, newTodo without value

I am looking at this redux example, and find one strange code:

<TodoTextInput newTodo
onSave={this.handleSave}
placeholder="What needs to be done?" />


why the newTodo does not have any value? then what value is passed to the component?

thanks

Answer

newTodo is a boolean

When no value is set it's the same as doing newTodo={true} since obviously if it wasn't there it would be false.

Comments