score:1

Accepted answer

as the error says, you can't have useeffect called conditionally. instead, call it a single time regardless, and inside that function, look to see whether you need to fetch the clips or the comments.

useeffect(() => {
    if (boolean) {
        fetch("/clips")
            .then((r) => r.json())
            .then((data) => setclipdata(data));
            // don't forget to .catch errors here
    } else {
        fetch("/most_comments")
            .then((r) => r.json())
            .then((data) => setclipdata(data)); // did you mean to call setcommentsdata or something here?
            // don't forget to .catch errors here
    }
}, []);

Related Query

More Query from same tag