At first, it looks like you have too many returns.
I pasted this into a glitch pen and it immediately gave lint/compile errors which pointed to a misuse of braces and jsx.
The first fix is to explicitly enter JSX mode before opening the js braces by adding a new React.Fragment. I also needed to remove the return inside a return because that’s an obvious syntax error, as well as the extra semicolon halfway through an expression:
return(<React.Fragment>
{tests ? tests.map(test => {
return (<React.Fragment>{test._id}</React.Fragment>);
}) : <React.Fragment>there isn't any data</React.Fragment>
}
// function doesn't work at all
{addAnotherTest()}
</React.Fragment>);
Also to demonstrate, if you remove the call toaddAnotherTest you can remove the opening braces altogether, because you are already in js mode at the start of the return statement:
return(
tests ? tests.map(test => {
return (<React.Fragment>{test._id}</React.Fragment>);
}) : <React.Fragment>there isn't any data</React.Fragment>
);