Sign in
Log inSign up

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));