Next.js Discord

Discord Forum

Suspense Loading Overhead

Unanswered
JJSenpai posted this in #help-forum
Open in Discord
I am trying suspense boundary, but even in a non consuming code I can see loading state for 1 second. How do I get rid of this overhead?

export default function Page() {
    const [state, setState] = useState(1);
    return (
        <div>
            <button
                onClick={() => {
                    setState(state + 1);
                }}
            >
                INCREMENT
            </button>
            {state}
            <Suspense fallback={<div>Load</div>}>
                <Test state={state} />
            </Suspense>
        </div>
    );
}


export default async function Test({ state }: { state: number }) {
    return <div>ANANT : {state}</div>;
}

0 Replies