0

I have onchange callback(been called from child to parent) function in one of the component i was trying to simulate onchange function as shown but i am getting error as 'getchangeChecbox' is not a function

childcomponent

<checkbox
label="checkbox input"
value={checkBoxInitalState}
onChange={e => { toggleCheckbox(e);  selectOption(e?'A':'B') }}

testcase

checkBoxValue.props().onChange(false)
output.update()

Error

toggleCheckbox is not a function

how do i simulate onchange in this scenario?how to check selectoption value(selectoption is a function)

R9102
  • 687
  • 1
  • 9
  • 32
  • The error tells you that `toggleCheckbox` is not a function, so the `onChange` has been called. Can you show more code from your ChildComponent? Thanks! – Gabriel Pichot Sep 26 '22 at 07:55
  • @GabrielPichot in a parent component I am calling the function and setting the state later I am passing the function to a child component togglecheckbox – R9102 Sep 26 '22 at 08:02

0 Answers0