freeCodeCamp / pantry-for-good

An open source food bank logistics and inventory management tool
Other
395 stars 189 forks source link

Show password confirmation warning only when fields touched #339

Closed wacii closed 6 years ago

wacii commented 6 years ago

A couple refactorings accompany this.

Changes render = () => { to render() {. The first binds the render function each time a component instance is created, but this is unnecessary as render is already called with component instance. It just creates needless functions.

The state and props are destructured to avoid continuously reaching into the respective objects and to make the methods, i.e. this.onFieldChange, more obvious.