score:2
Accepted answer
i have to suggest for run your build app u can maka virtual host for that using wamp/xamp server ex: myapp.local
or
you can use
npm install -g serve
serve -s build
for build app and run your build app on static sever 5000 port .
serve -h
for more details u can check above command.
score:0
import react, { component } from 'react';
import home from './components/home';
import login from './components/login';
import { browserrouter as hashrouter, route, switch } from 'react-router-dom';
class app extends component {
render() {
return (
<hashrouter >
<div classname="container">
<switch>
<route exact path="/home" component={home} />
<route exact path="/" component={login} />
</switch>
</div>
</hashrouter>
);
}
}
export default app;
score:0
i think you have to mistake import of your component
import login from '../login'
import home from '../home'
try this one and let me check.
import login from './login'
import home from './home'
Source: stackoverflow.com
Related Query
- Nested routing is not working in React Router v6
- Nested Routing Not Working in React Router v6
- CSS not working for nested routing in react js
- React routing not working while manually changing URL | React-router 4
- Hash routing Navigation is not working - react router redux
- Why React routing not working in component?
- React routing not working
- React routing is not working
- Routing not working in a webpack + react project
- React Routing not working on Heroku Deployment
- React routing not working in react boilerplate
- Framework7 react routing not working
- React routing on click event is not working
- Routing with routers not working in react js
- I created one react project and I started working on Routing, Routing is working fine but Navbar is not working properly
- React JS routing not working
- React routing in not working in react js?
- Routing not working in a react app with webpack
- React nested routing not working properly
- React Router v4 Nested Routing not working when in sub level
- Routing not working as per expectation in React on Application Server like tomcat but it works on Node server
- Nested routing is not working in React Router dom V4 from individual component and works only from App.js component
- Protected Routes and Nested Routes are not working together in react routing
- MVC routing not working C# backend React frontend
- onKeyDown event not working on divs in React
- ReactJS Bootstrap Navbar and Routing not working together
- React colspan not working
- React Routing works in local machine but not Heroku
- React router private routes / redirect not working
- proxy not working for react and node
More Query from same tag
- Cannot pass object data to modal
- React JS: Debounce
- reactjs checkbox check and unchecked event
- Dynamic Form Name for redux-form
- API Data undefined in react
- How to detect if initial page load was from a redirect
- map if statement if every 3rd include this
- React Tutorial :Composing components show blank page
- React - State from class to hook
- How to properly use this jQuery script in my Next.Js app?
- How to get input values using functional component with useState
- I am try to make a ray Sphere intersection function work for a post-processing effect in threejs but am stuck
- React - setState errir - can't update during state transition
- How to create object array in react for graphql
- How to render text and components at the same time
- How to declare array as any: when using UseState hook?
- How to render array of object?
- TypeError: Cannot read property 'map' of undefined jest.js
- Extract an arrays of objects into one array using ES6
- Get list of Fields of an Ant Design Form
- How to render `React Component` not to the DOM
- Is there a way to pass an Apollo query selection through react props?
- Does the passport.js support ajax?
- axios.create of jest's axios.create.mockImplementation returns undefined
- How to Accept File and string data from Post Request in ASP.Net Core 2.0?
- Material-UI v5 override MuiSwitch input
- useEffect is not always called with React Router
- Better way for writing the reducers?
- How to sort an aray in ReactJS like AngularJS
- React 16.7 Hooks : `react.useState` is not a function