Javascript TypeError:inputProps.onChange.call不是函数

Javascript TypeError:inputProps.onChange.call不是函数,javascript,reactjs,Javascript,Reactjs,由于标题错误,我的测试失败。这是我的设置和测试: let renderedOutput; beforeEach(() => { const handleBodyChange = sinon.stub(); renderedOutput = mount (<MessageDetail handleNameChange handleBodyChange/>); }); it('calls the handleBodyChange f

由于标题错误,我的测试失败。这是我的设置和测试:

  let renderedOutput;
    beforeEach(() => {
      const handleBodyChange = sinon.stub();
      renderedOutput = mount (<MessageDetail handleNameChange handleBodyChange/>);
    });

  it('calls the handleBodyChange function', () => {
    const input = renderedOutput.find('#senderMsgBody');
    input.simulate('change', { target: { value: 'My message' } });
    expect(handleBodyChange).to.have.been.calledWith();
  });
可以发布更多代码,但任何关于我为什么会出现此错误的想法(在每个函数之前的
中)都不会将属性绑定到正在渲染的组件。
您定义了道具,但未传递任何值

可能是这样的

<MessageDetail 
    {handleNameChange} 
    {handleBodyChange}/>



你能把扩展'React.Component'的类的代码放在这里吗?我有,
MessageDetail
Component extends React.Component@ShridharR.kulkarnisomethods如果你错过了构造函数中的绑定,就会出现这个错误。我认为你应该发布更多的代码,这样社区可以在你缺少任何其他东西时帮助你。如果我尝试这样做,它只是说:
handleNameChange没有定义
是的,你只为你的
handleBodyChange
创建了一个存根。您可能还需要一个用于
handleNameChange
<MessageDetail 
    {handleNameChange} 
    {handleBodyChange}/>
<MessageDetail 
    handleNameChange={handleNameChange}
    handleBodyChange={handleBodyChange}/>