I have started doing a project in react js and i have been trying to wrap my head around routing and other concepts, i have had a problem with the routing and the problem is, when i run the project, there is a button in home page and then i click on that button, it should go to other pages, in my case, when the button is clicked, the content appears right on the bottom the home page.
App.js
import * as React from 'react';
import {BrowserRouter as Route, Routes} from "react-router-dom";
import { LandingPage, NavBar, Footer } from './Containers';
import './App.css';
import Scroll from './scroll';
function App() {
return (
<div className="App">
<div>
<NavBar />
<LandingPage />
<Routes>
<Route path="/scroll" element={<Scroll />} />
</Routes>
<Footer />
</div>
</div>
);
}
export default App;
landingPage.js
import React from "react";
import { Route, Routes, useNavigate, Link } from "react-router-dom";
import Scroll from "../../scroll";
import "./landingPage.css";
const LandingPage = () => {
const Navigate = useNavigate();
const handleClick = () => {
Navigate('/scroll');
}
return (<>
<div >
<div >
<div >
<h1 >Amet minim mollit non deserunt ullamco est sit aliqua dolor doamet sint. Velit officia</h1>
<p >Amet minim mollit non deserunt ullamco est sit aliqua dolor doamet sint. Velit officia consequat duis enim velit mollit. Exercitation veniam consequat sunt nostrud amet.</p>
<h3>
<div >
<Link to={"./scroll"}>
<button onClick={()=>handleClick()}>
<bold>Get Started</bold>
</button>
</Link>
</div>
</h3>
</div>
</div >
</div>
</>
);
};
export default LandingPage;
scroll.js
import React from 'react'
import HorizontalScroll from 'react-scroll-horizontal';
import './scroll.css';
import { Execution1, Execution2, Execution3, Execution4, Execution5, Execution6, Onboarding, PDP } from './Containers';
function scroll() {
const Object = {height: `77%`, width: `100vw`}
return (
<>
<HorizontalScroll reverseScroll={true} style={Object} >
<PDP className="main"/>
<Onboarding className="main" />
<Execution1 className="main" />
<Execution2 className="main" />
<Execution3 className="main" />
<Execution4 className="main" />
<Execution5 className="main" />
<Execution6 className="main" />
</HorizontalScroll>
</>
)
}
export default scroll
The ones in ./Containers are components like landing page. What i wanted to do was, when we click in the button of LandingPage, the whole component from scroll.js schould appear and they should be rendered horizontally.
but, as of now. i can only see the urls changing but not the contents.