I'm having trouble importing a function in react. I used export default
to export the function. However after importing it I tried to bind it in the render function but I got an error saying TypeError: Cannot read property 'bind' of undefined
. Does this mean the function did not correctly import? How do I correctly import it in React?
import onSignUp from '../../functions/onsignup'
class ModalExample extends React.Component {
constructor(props) {
super(props);
}
this.onSignUp=this.onSignUp.bind(this);
}
render(){
return(...)
}
See Question&Answers more detail:os