Home > Net >  Props is undefined when passed to a child component (react hooks)
Props is undefined when passed to a child component (react hooks)

Time:09-27

I am building a simple agenda component and ran into a problem. The idea is that when a person clicks on the day and then sees trainings from this specific day. My logic is the following

  1. On button click I set state to day id
  2. On existing active item Ternary operator renders the component
  3. I am passing function invocation as props, which returns up-to-date object.

I tried putting function invocation to handleClick function, which did not help. For me it seems that the problem can occur with function not returning the value in time for component to pass it, but I don't know how to bypass this problem. Here is the codesandbox with everything - please help

Edit blazing-dawn-pmixb

  • Related