Im new to React and i have the following app: (index.js)
import ReactDOM from 'react-dom'
import {Component} from 'react';
import './style.css'
import {
BrowserRouter as Router,
Switch,
Route,
Link
} from "react-router-dom";
import Header from './components/Header'
import Body from './components/Body'
import Footer from './components/Footer'
class App extends Component {
render() {
return (
<div id="layout">
<Header />
<Body />
<Footer />
</div>
);
}
}
ReactDOM.render( <App />, document.querySelector("#root"));
Each time I'm going to localhost:port Im redirected to this componenet,
I wanted to use Router and extract the data, for example:
localhost:port/instanceName=value will route me to same compontents with props value only if value is x or y, is that possible?
useParamsto extract the URL parameters, then render the proper component based on them.?foo=bar) or path (/bar) parameters?