Passing a component to the useState() hook

Actually, you shouldn't put any react component inside state variable. About this point, you can check this site or this similar question to read more details.

Now, to make this work you can just use an object to map the components you need:

function Page1() {
    return <p>Hello world!</p>
}

function Page2() {
    return <p>Hello world!</p>
}

const components = {
 'page1': Page1,
 'page2': Page2,
}

export default function App() {

    let [page, setPage] = useState('page1');

    return (
        <div id="app">
            <components.page />
        </div>
    );
}

In this way, you just have to change the object key string in the state and it should reload you printed component.