TypeError: this.props.emit is not a function

HI,

I get the below error.

I’m trying to call a ‘start()’ function on Submit button.
I just can’t figure out why.

I tried using the arrow function for the start function Eg: start=()=>{}
But this did not work either. Any help is so much appreciated.

TypeError: this.props.emit is not a function
JoinAdmin.start
e:/BootCampUNC/Class/Assignments/FinalProject/newCreateReact/testapp/client/src/Components/JoinAdmin.js:10
   7 | start(){
   8 |     var adminName = ReactDOM.findDOMNode(this.refs.name).value;
   9 |     var pollName = ReactDOM.findDOMNode(this.refs.PollName).value;
> 10 |     this.props.emit('start'); 
     | ^  11 |     // send this back to the server
  12 |     
  13 |     console.log ("name: "+ adminName +" pollName:" + pollName)
View compiled
onSubmit
e:/BootCampUNC/Class/Assignments/FinalProject/newCreateReact/testapp/client/src/Components/JoinAdmin.js:19
  16 | render() {
  17 |     return (
  18 |         <div>
> 19 |         <form action="javascript:void(0)" onSubmit={()=>this.start()}>
     | ^  20 |             <label> Full Name </label>
  21 |                 <input ref="name" 
  22 |                 className="form-control" 

This is hard to diagnose without seeing the code.

But basic troubleshooting…

It says, “this.props.emit is not a function”. Whenever something happens that isn’t what I expect, I start working backwards until I find where what I expect and what is really happening diverge. My first step would be to put a console.log('this.props.emit', this.props.emit); on the line before it is called and find out exactly what this.props.emit is. Then I’d start working back to where it is passed in (probably a parent component or if you are using redux, then either mapDispatchToProps or even mapStateToProps).

Look. Find where the divergence is.

Thank you!!
I went backwards like you said and found that I did not pass the emit props in the routes.

I never went that far back in my search.