react-book icon indicating copy to clipboard operation
react-book copied to clipboard

Chapter 08, Exercise Practice3.js,

Open Ilya-Lad opened this issue 5 years ago • 3 comments

The code for the UserForm is given as const UserForm = props => (

: //Incorrect

);

This seems incorrect. At least the last double quotes should be removed for the state to update. The works for me: for example,

: //REMOVED QUOTES

Ilya-Lad avatar Dec 12 '20 03:12 Ilya-Lad

Seems like the code I typed have not come through. In essence, onChange = "{props.onChange}" does not allow state to update. The double quotes must be removed for the state to update.

Ilya-Lad avatar Dec 12 '20 03:12 Ilya-Lad

@Ilya-Lad You are correct the double quotes need to be removed here. Created a PR: https://github.com/zgordon/react-book/pull/31

JimMcKenzieSmith avatar Jan 02 '21 07:01 JimMcKenzieSmith

Same for id and htmlFor. it is given

<label htmlFor="{props.id}">{props.label}</label>: <input id="{props.id}" type="text" onChange="{props.onChange}" />

but should be

<label htmlFor={props.id}>{props.label}</label>: <input id={props.id} type="text" onChange={props.onChange} />

ShadeVI avatar Jan 19 '21 13:01 ShadeVI