import React from 'react';
import { Link } from 'react-router-dom'
class Home extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<p>Welcome to the React tutorial</p>
<p><Link to="/list">Click here</Link> to view expense list</p>
<p><Link to="/add">Click here</Link> to add new expenses</p>
</div>
)
}
}
export default Home;
Home Component
In the above code, we are importing the react and react-router-dom packages. The Home component has two children - a div and a p. The div will have a Link element nested inside it. The Link element will contain two links - one to the /list route and another to the /add route. The p will have a Link element nested inside it as well.
0 Comments
Add Comment
Log in to add a comment