React: passing props from child to parent

I've detailed my question on SOF for readability and clarity, appreciate any help! https://stackoverflow.com/questions/76932958/passing-props-from-child-to-parent
Stack Overflow
Passing props from child to parent
I've got a side-nav.js which has the list of categories of items, I want to grab the categoryid and pass it to the parent layout.js, then to the parent of layout.js -> customer.js. Currently I'm
6 Replies
xel
xel10mo ago
what's the parent of layout.js ? where is setSelectedCategory coming from
Reformed
Reformed10mo ago
the parent of layout.js is customer, I'm not sure if i even need setselectedcategory
xel
xel10mo ago
the error is simply saying that it's not a function but you're trying to call it like it is props.setSelectedCategory(category.id)
Reformed
Reformed10mo ago
yea usually i would just do props.category.id but that is giving me error as well
xel
xel10mo ago
put your code in a codesandbox or something easier to help then