ReactJs Uncaught Error: Expected `onClick` listener to be a function, instead got a value of `object` type reactjs uncaught typeerror is not a function,reactjs uncaught (in

If you want to call the function of child component from your parent component you need to use ref's in React here is how you do it:

import React from 'react';
import './Square.css';
import Controller from './controller.js';

class Square extends React.Component {
 render() {
    return (
    <div className="square" onClick={this.child.changePlayer();}>
        {this.props.children(<Controller  ref={instance => { this.child = instance; }}/>)}
      </div>
    )
  }
}

export default Square;
Answer:1



  1. reactjs uncaught typeerror is not a function
  2. reactjs uncaught (in promise)
  3. reactjs uncaught syntaxerror unexpected identifier

I'm trying to develop a simple CMS for my page. I want it to where I can edit and delete a users reply on click of a button. I got the delete functionality done so I figured for the reply ...

I'm trying to develop a simple CMS for my page. I want it to where I can edit and delete a users reply on click of a button. I got the delete functionality done so I figured for the reply ...

So I'm trying to create an image lightbox within my const but whenever I try to set the state it won't let me and instead I keep getting an error that says that 'isOpen' is assigned a value but never ...

So I'm trying to create an image lightbox within my const but whenever I try to set the state it won't let me and instead I keep getting an error that says that 'isOpen' is assigned a value but never ...