create-react-app-with-redux
create-react-app-with-redux copied to clipboard
some code issues
Awesome stuff, thanks for this repo!
I found some code issues I would like to raise:
-
No need for component state. Safe to delete these lines https://github.com/tstringer/create-react-app-with-redux/blob/master/src/components/PeopleContainer.js#L12-L14
this.state = { people: [] }; -
person.lastnameis not a safe key since cannot guarantee uniqueness https://github.com/tstringer/create-react-app-with-redux/blob/master/src/components/PeopleList.js#L8<Person key={person.lastname} person={person} /> -
Avoid using the document object (getElementById). https://github.com/tstringer/create-react-app-with-redux/blob/master/src/components/PersonInput.js#L11
const firstNameElement = document.getElementById('firstname');
For the last issue, consider refs, or even better- no refs at all and just more props < ... focus={isFocused} >
Really great information! And totally agreed with these.
Thanks!