Benjamin Li Benjamin Li - 1 year ago 122
React JSX Question

In React with Redux, newTodo without value

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

<TodoTextInput newTodo
placeholder="What needs to be done?" />

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


Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download