I've seen a few questions similar to this but I nothing is honestly helping me. How do you redirect with a button click in ReactJs?
Website.js
import React from 'react';
import ReactDOM from 'react-dom';
import { withRouter, useHistory } from 'react-router-dom';
//css imports
import './App.css';
import './SplashPage/splashpage.css';
//File Imports
import Resume from "./Resume/resume.js";
//Component Import
import Button from '@material-ui/core/Button';
function App() {
const history = useHistory()
return (
<div className="App">
{ <div id="cf">
<Button onClick={() => history.push(Resume)}>
CLICK ME
</Button>
</div> }
</div>
);
}
export default App;
I honestly think that I have tried too many options and I've just confused myself even more. From what I understand, the useHistory() function seems to be the correct way to go but as of now I get "TypeError: history is undefined".
Thank you for help!