reactjs navigate blank
In ReactJS, you can navigate to a blank page by using the window.location object to change the URL of the current page. Here's an example:
import React from "react";
function BlankPage() {
const navigateToBlankPage = () => {
window.location.href = "/blank"; // Replace "/blank" with the desired URL of the blank page
};
return (
<div>
<h1>Click the button to navigate to a blank page</h1>
<button onClick={navigateToBlankPage}>Go to Blank Page</button>
</div>
);
}
export default BlankPage;
When the button is clicked, the navigateToBlankPage function will be called, which changes the URL to the specified blank page
原文地址: https://www.cveoy.top/t/topic/iaFo 著作权归作者所有。请勿转载和采集!