Create a React Context or add to same line, avoid prop drilling


TL;DR Prop drilling can be complicated and create buggy apps, try to avoid it.

When you doing props drilling it’s important to know the limitations. A good rule is that if its small enough put it in the same component then do this. If it’s too large to put in the same component use React context. This will avoid the creation of buggy app logic.

The input form for a CRUD page which I was working on, I found out putting it in the same file would’ve saved me a day and a half of work.

There is nothing wrong with having 200+ line files. Located here is the file of discussion (204 lines).

Still there is more CRUD logic to be created in order to edit previously submitted records.

Getting Ahead: Your first 2,000 dollars on Upwork

$4.99

Are you a developer dreaming of location independence and a lucrative career? This ebook is your roadmap to success on Upwork, one of the world’s leading freelance platforms. Whether you’re a seasoned coder or just starting out, we’ll guide you through the most effective strategies to reach that crucial $2,000 milestone.

Category:

Leave a Reply