I have an array of routes. Each route is it's own object which gets iterated to define. I would expect to be able to use the header key within main() using the 'this' keyword, but it's undefined. What am I missing here?
const loggedInRoutes = [
{
path: '/home',
exact: true,
isPrivate: true,
header: 'Home',
main() {
console.log(this); // undefined
return (
<HeadWrap header={this.header}> // property 'header' undefined
<Home />
</HeadWrap>
);
},
},
]