by ryansolid · 1w ago · 0 comments
Yeah that's what I mean.
A lot of my react components start out with the equivalent of
if (state==error) return <p>error</p>;
if (state==loading) return <p>loading</p>;
if (!connection) return <p>offline</p>;
if (admin) return <Redirect/>;
doing that with <Show /> (and passing the function so TypeScript still works) means the conditions take 20 lines instead of 4, and the meat of my component is indented an extra 8 levels.