Yeah, I agree, as long as it works. Oh well, no worries, haha
I really appreciate your taking a look, too
Yeah, I agree, as long as it works. Oh well, no worries, haha
I really appreciate your taking a look, too
Is the finished code for this tutorial hosted somewhere? Thanks!
have been solve
Follow this
import React, {
Component
} from 'react'
import {
BrowserRouter as Router,
Route,
Link
} from 'react-router-dom';
import Home from './Home'
import Stuff from './Stuffâ
import Contact from './Contact'
export default class Main extends Component {
render() {
return (
<Router>
<div>
<h1>Simple SPA</h1>
<ul className="header">
<li>
<Link to="/">Home</Link>
</li>
<li><a href="/stuff">Stuff</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
<div className="content">
<Route exact path="/" component={Home}/>
<Route path="/stuff" component={Stuff}/>
<Route path="/contact" component={Contact}/>
</div>
</div>
</Router>
)
}
}
What is the problem here?
Thank you for a very well written, detailed article. This post is a very good start to understand React router for SPA
I created build for this application, and then i kept that folder on httpd server. But itâs not working. Am I did any thing wrong here?
What error are you seeing? Are the paths to the JS and CSS still accurate in the HTML file?
index.js >>>
import React from âreactâ;
import ReactDOM from âreact-domâ;
import Home from â./Homeâ;
ReactDOM.render(< Home />, document.getElementById(ârootâ));
Home.js
import React, {Component} from âreactâ;
import ReactDOM from âreact-domâ;
import {
Route,
NavLink,
HashRouter
} from âreact-router-domâ;
import Login from â./Loginâ;
import SignUp from â./SignUpâ;
class Home extends Component {
render (){
return (
< HashRouter>
< div>
< ul>
< li>< NavLink to="/ SignUp">SignUp</ NavLink>< /li>
< /ul>
< /div>
</ HashRouter>);
}
}
export default Home;
SignUp.js
import React, {Component} from âreactâ;
import ReactDOM from âreact-domâ;
import SignUpCSS from â./SignUpCSS.cssâ
class SignUp extends Component {
render(){ return (
Please fill in this form to create an account.
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" required/>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required/>
<label for="psw-repeat"><b>Repeat Password</b></label>
<input type="password" placeholder="Repeat Password" name="psw-repeat" required></input>
<label>
<input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> Remember me </input>
</label>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="button" class="cancelbtn">Cancel</button>
<button type="submit" class="signupbtn">Sign Up</button>
</div>
</div>
</form>
</div>);
}}
export default SignUp;
Please find the above three page
I am not able to redirect SignUp even not getting any error whats I am missing here
Can you please make the same single page application using next js router , please I request or send me the code : mail : [email protected]
Hi,
Iâm following this tutorial by writing it step by step and always get this yellow blank page with Error:
index.tsx:19 Uncaught Error: A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .
what did i do wrong?
Can you share the contents of index.tsx?
Hi,
Exactly the same mistake, Iâve already tried everything. I installed React Router DOM, then inserted files from your GitHub and still gives the same thing. Maybe something with the version? (my versions:
âreactâ: â^17.0.2â,
âreact-homeâ: â^17.0.2â,
âreact-router-homeâ: â^6.2.1â,)
:: Copyright KIRUPA 2024 //--