My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Making re-useable component

Tzahi Ben Artzi's photo
Tzahi Ben Artzi
·Nov 9, 2017

I am fairly new to ReactJS

I got a navbar, and I'm trying to make the buttons for it from React so I'll be able to achieve SPA. I am trying to create 1 button class with a constructor so I'll be able to do it for all my buttons.

This is what I'm trying to do:

class Button extends React.Component {
  //insert constructor
  handleClick = () => {
    ReactDOM.render(this.SpecficiInformation, document.getElementById('content'))
  }

  render() {
    return (
      <p onClick={**this**.handleClick}>

      {this.name}
      </p>
    );
  }
}

ReactDOM.render(<Button />, document.getElementById(this.elementid));