HarisSpahija / hybrit-wordpress-frontend

React Frontend for headless wordpress
MIT License
5 stars 1 forks source link

Matched leaf route at location does not have an element #2

Open Robin-Lord opened 2 years ago

Robin-Lord commented 2 years ago

Hi there, I've been trying to follow along with your blog post using this code but when I do I get the error saying that the matched leaf at each of my WordPress routes doesn't have an element. I've tried changing "render" to "element" like this

element={props => (<ExamplePage {...props} page={page} />)}

but no luck. I've searched around but all of the debug recommendations are just that - make sure there is an "element" declared. Any help would be massively appreciated.

Thanks

brightstarmoxiz commented 2 years ago

//App.js

}/>

//productScreen page

import React from 'react'; import data from '../data' import Rating from '../component/Rating' import { Link } from "react-router-dom"

export default function ProductScreen (props) { console.log(props.match.params.id) const product = data.products.find((x) => x._id === props.match.params); console.log(product); if (!product) { return

Product Not Found
; }

//the console in the web browser

matched leaf route at location "/product/1" does not have an element. This means it will render an with a null value by default resulting in an "empty" page.

pls wat is the solution. pls urgent ans