Relative Content

Tag Archive for reactjsreact-routerundefinedreact-props

Why cannot destructure property “xxx” of “undefined ” as it is undefined when parent Component give values?

I’m actually working on a fake Shopping cart project with React for The Odin Project ( a free cursus online to learn Javascript ). I’m working with Vite, React-Router and Vitest for this project. I have created a router with App component as homepage and it have a child “Landing” who is displayed in App by an Outlet. My App component is basically a Header component and Outlet ( supposed to display Outlet ). My Header component take 2 props, items and sum and inside this component I’ve declared defaultProps with fake values.