I need to redirect a page using HTTP programmatically only. The following code achieves this:
export const getServerSideProps: GetServerSideProps = async (context) => {
return {
redirect: {
destination: '/',
permanent: false,
},
}
}
function Home() {
return <></>
}
export default Home
Can a page be created without a React component, or should a function within the API directory be used for this task?
If so, how can a function in the API directory be utilized for this purpose?