title: Element type is invalid: expected a string (for built-in components) or a class/function React Error
body: <p>I have a problem with React when I try to change the page through the button (but) the console gives me: </p>
  
  <blockquote>
    <p>Element type is invalid: expected a string (for built-in components) or >a class/function (for composite components) but got: undefined. You >likely forgot to export your component from the file it's defined in.</p>
  </blockquote>
  
  <p>But when I put the <code>onClick</code> code in the class code it shows the jsx code. So it works but why do I still get the error? Here is my code: </p>
  
  <pre><code>import React from 'react';
  import {render} from 'react-dom';
  
  //sass
  require('../sass/style.scss');
  
  var pages = ['Qrscan'];
  var jsx = [&lt;Qrscan /&gt;];
  
  class App extends React.Component {
      constructor (props) {
          super(props);
          this.state = {target: &lt;Menu /&gt;};
          App.changePage = App.changePage.bind(this);
      }
  
      static changePage (tar) {
         this.setState({target: tar});
      }
  
      render () {
          return (
            this.state.target
          )
      }
  }
  
  
  //Rendering
  class Menu extends React.Component {
      render() {
          return (
              &lt;div id="root"&gt;
                  &lt;Header /&gt;
                  &lt;div className="container"&gt;
                      &lt;But target="Qrscan" class="button button-QR" text="Use QR code" type="button" linkTo="" /&gt;
                      &lt;But class="button button-URL" text="Use URL" type="button" /&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          )
      }
  }
  
  class Qrscan extends React.Component {
      render() {
          return (
              &lt;h1&gt;test&lt;/h1&gt;
          )
      }
  }
  
  //elements
  class Header extends React.Component {
      render () {
          return (
              &lt;div className="header"&gt;
                  &lt;div className="header-logo"&gt;Jukey&lt;/div&gt;
              &lt;/div&gt;
          )
      }
  }
  
  class But extends React.Component {
      getInfo () {
          for (var i = 0; i &lt; pages.length; i++) {
              if(pages[i] == this.props.target) {
                  return jsx[i];
              }
          }
      }
  
      render () {
          return (
              &lt;button onClick={() =&gt; App.changePage(this.getInfo())} className={this.props.class}&gt;{this.props.text}&lt;/button&gt;
          )
      }
  }
  
  render (&lt;App /&gt;, document.getElementById('app'));
  </code></pre>
  
  <p>Thank you for taking the time to help me with my problems!</p>