Post

Most of the time, boolean props on react components are a bad idea. They don't evolve well. More boolean props create impossible states and the component becomes a "thing" that does way too much. Go for string literal union types and slot props (composition) more often than not.

3 reposts51 likes

I never thought of this. 🤯 Checked code on a large personal project of mine and turns out I've been avoiding bool props without realising!

Actually it might have not been in my production code, think it was me messing around with a repo someone cant get working. (Think it was `props: {loading: true} | {loading: false, data: {...} }`)

I felt this. I've dabbled in react because it seemed like a good option for some projects, but rather quickly felt lost in the rendering iterations. As a backwards learner that wants to start with the hard part and work my way back, do you have a good resource to recommend?