score:0
please app.js file.
import react, { component } from "react";
import { route, switch } from "react-router-dom";
import 'bootstrap/dist/css/bootstrap.min.css';
import moviedetail from "./components/navcomponents/moviedetails";
import rtest from "./components/navcomponents/rtest";
class app extends component {
state = {
// products: [ { id: 1, name: 'product 1' }, { id: 2, name: 'product 2' }, { id: 3, name: 'product 3' } ]
card: [],
pagesize: 6,
currentpage: 1,
cartitems: []
};
render() {
return (
<div>
<navigation></navigation>
<div classname="content">
<switch>
<route path="/catalouge" render={(props)=>
<catalouge
pagesize={this.state.pagesize}
{...props}
catimages={this.state.card}
onaddapp={this.handleadd}
oncartaddapp={this.handlecartadd}
>
</catalouge>}>
</route>
<route path="/login" component={login}></route>
<route path="/tocart"
render={(props)=>
<shoppingcart cartitems={this.state.cartitems} {...props}></shoppingcart>} />
<route path="/posts" component={posts}></route>
<route path="/customers" component={customers}></route>
<route path="/movies" component={movies}></route>
<route path="/movie/details" exact component={(props) => <moviedetail {...props} />} />
{/* <route path="/rtest" component={rtest} /> */}
</switch>
</div>
</div>
);
}
}
export default app;
Source: stackoverflow.com
Related Query
- Nested routing is not working in React Router dom V4 from individual component and works only from App.js component
- Nested routing is not working in React Router v6
- React router dom passing data from parent component to child router component does not pass the props.match
- Nested Routing Not Working in React Router v6
- Nested Route not working in react router dom for my admin dashboard
- Styling the active link using the NavLink component from React Router is not working as expected
- External link not working when using LINK from react router dom
- (New) React Context from a Nested Component not working
- React Router v4 Nested Routing not working when in sub level
- React router dom is working for some component but not working for another component
- React router dom : <Redirect/> is not working for invalid nested path's like localhost:9090/{invalidaa}/{invalidb}/{invalidc}
- React router - Nested routes not working
- React Context API not working from custom NPM component library
- React router Link not causing component to update within nested routes
- React router dom redirect problem. Changes url, does not render component
- I can not get the state from react router Link component using useLocation. So how can I pass it?
- Reactjs react router dom useParams not working with dynamic url
- React Hooks: Component is not rendering in Nested Routing
- Updating Context from a Nested Component is not Working
- React router nested not working
- react router dom not working when changing the path
- React Router "Link to" does not load new data when called from inside the same component
- how to fetch a nested resource for every component in React router dom route
- Redirect in React Router not working when I click from Users to Post
- React router dom (6.0.1) child route not working properly
- Nested routes with react router v4 not working
- Problem referencing redux store, state & context of nested component routes in react router dom v6
- CSS not working for nested routing in react js
- React Router V4 nested routers are not working on page reload
- React Router v5: Route defined in child component not working
More Query from same tag
- Send form data from React to ASP.NET Core API
- Scroll to selected list item in material-ui
- mdbreact modal applies a class 'modal-open' to body tag even if the modal is not open yet
- ASP.NET Core Identity SPA with React
- How do I pass a URL Param to a selector
- Cannot read property 'suppressHydrationWarning' of null
- Why won't my app render when state changes?
- Reactjs Rest API response decode JSON
- Getting OAuthCallbackError with nextjs Auth
- React won't load local images
- How does the override for the default.props occur
- Uncaught TypeError: formData is not iterable
- React js reset state of a component if the parent component has re-rendered
- React & Redux : cannot read property of undefined
- Sinon.js - stub React component's function before component is instantiated?
- Unexpected state behaviour while dynamically rendering elements in React typescript
- How to get specific value when changing Autocomplete component of Material UI
- How to take a link from one array and assign it to another?
- How to get Element using useRef in ReactJS
- React Nav Links Not Displaying Content
- React component doesn't render when I change its state
- this.state is undefined inside child component
- Enqueue and Dequeue using ES6 spread operator
- parsing json response in react native
- How to remove element from array object use in redux reduce state?
- turn html into string but keep all html tags javascript
- Array sort with React.useState breaks when adding certain date
- How do you reset a loading bar in react JS?
- momentjs and react - to disable days checked against an array of days
- How to fetch onChange from select value only when select ? is it possible without using useEfect?