title: Why are my buttons not rendering in react?
body: <p>So I'm new to react and I would like   add rendering logic so that the "Update Course" and "Delete Course" buttons only display if:</p>
  
  <ul>
  <li><p>There's an authenticated user.</p></li>
  <li><p>And  <code>user._id</code> matches <code>UserId</code>
  here is what I have so far:</p></li>
  </ul>
  
  <p><strong>CourseDetail</strong></p>
  
  <pre><code>    class CourseDetail extends Component {
                constructor(props) {
                  super(props);
                  this.state = {
                    course: [],
                    user: [] //user state contains user data
                  };
  
                  this.handleButtonLogic = this.handleButtonLogic.bind(this);
                }
  
                  componentDidMount() {
                    this.handleButtonLogic() {
                  }
  
  
                handleButtonLogic() {
                  const user = this.state; 
                  const isLoggedIn = localStorage.getItem('IsLoggedIn');
                  const UserId = localStorage.getItem('UserId');
                  const button = document.getElementsByName('button')
              if (!isLoggedIn &amp;&amp; user._id !== UserId) {
               button.style.display = 'none'
              }  else {
                button.style.display = ''
              }
                }
  
              render() {
          const { course, user } = this.state;
  
          return (//JSX inside
            &lt;div&gt;
              &lt;div className="actions--bar"&gt;
                &lt;div className="bounds"&gt;
                  &lt;div className="grid-100"&gt;
                    &lt;span&gt;
                      &lt;NavLink to={`/courses/${course._id}/update`} className="button"&gt;Update Course&lt;/NavLink&gt; 
                      &lt;NavLink to={"#"} className="button" onClick={this.handleDelete} &gt; Delete Course&lt;/NavLink&gt;
                    &lt;/span&gt;
      }
  
  export default CourseDetail;
  </code></pre>
  
  <p>this is the error I get:</p>
  
  <p><a href="https://i.stack.imgur.com/FC5wR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FC5wR.png" alt="React Error"></a></p>
  
  <p>can someone help?</p>