anjani-sprinklr / todoF

0 stars 0 forks source link

Best practices #2

Open hardikmodi1 opened 5 months ago

hardikmodi1 commented 5 months ago

https://github.com/anjani-sprinklr/todoF/blob/d852183cb227477fb93d5883fd08bd7bdd52866e/src/App.js#L35 !=->!== Read about difference between these two operators, and also on line after this where we are setting the state. We don't have to everytime pass a function to setState

hardikmodi1 commented 5 months ago

https://github.com/anjani-sprinklr/todoF/blob/main/src/App.js#L82 ==->===

hardikmodi1 commented 5 months ago

https://github.com/anjani-sprinklr/todoF/blob/main/src/App.js#L94

hardikmodi1 commented 5 months ago

https://github.com/anjani-sprinklr/todoF/blob/main/src/App.js#L96 Since using everything from item, can pass entire item object to that component

hardikmodi1 commented 5 months ago

https://github.com/anjani-sprinklr/todoF/blob/main/src/App.js#L96

key should be part of that item itself, while creating the item, create one more field in item with this id and that can be used as id

hardikmodi1 commented 5 months ago

https://github.com/anjani-sprinklr/todoF/blob/main/src/item.js#L34

Things that can be derived should not be state, just update the state of parent component that will pass the updated status