title: Clicking link not rendering dom in reactjs
body: <p>First time data loads properly but when i click filter button like latest or top ajax is passing but view not getting updated. I am not sure what is wrong in my code. I am new to react js. 
  Here is my example code :- </p>
  
  <pre><code>import React from 'react';
  import ReactDOM from 'react-dom';
  import axios from 'axios';
  import css from './css/bootstrap.css';
  //import Search from './Search';
  
  class FetchDemo extends React.Component {
    constructor(props) {
      super(props);
  
      this.state = {
        posts: [],
        loading: true,
        error: null
      };
    }
  
    componentDidMount() {
      // Remove the 'www.' to cause a CORS error (and see the error state)
      axios.get(`https://newsapi.org/v1/articles?source=techcrunch&amp;apiKey=789ea3cd651a49e5ba9fc2061d68138f`)
        .then(res =&gt; {
           //console.log(res.data);
          // Transform the raw data by extracting the nested posts
          const posts = res.data.articles;
  
          //console.log(posts);
  
          // Update state to trigger a re-render.
          // Clear any errors, and turn off the loading indiciator.
          this.setState({
            posts,
            loading: false,
            error: null
          });
          //console.log(this.setState);
        })
        .catch(err =&gt; {
          // Something went wrong. Save the error in state and re-render.
          this.setState({
            loading: false,
            error: err
          });
        });
    }
  
    renderLoading() {
      return &lt;div&gt;Loading...&lt;/div&gt;;
    }
  
    renderError() {
      return (
        &lt;div&gt;
          Uh oh: {this.state.error.message}
        &lt;/div&gt;
      );
    }
  
    renderPosts() {
      if(this.state.error) {
        return this.renderError();
      }
  
      return (
        &lt;div className="row"&gt;
          &lt;First1/&gt;
          {this.state.posts.map(post =&gt;
            &lt;div className="col-md-3"&gt;
              &lt;img src={post.urlToImage} className="img-responsive" /&gt;
              &lt;h2 key={post.id}&gt;{post.title}&lt;/h2&gt;
              &lt;p className="lead"&gt;
                  by {post.author}
              &lt;/p&gt;
              &lt;p&gt;&lt;span className="glyphicon glyphicon-time"&gt;&lt;/span&gt; Posted on {post.publishedAt}&lt;/p&gt;
              &lt;p&gt;{post.description}&lt;/p&gt;
            &lt;/div&gt;
          )}
        &lt;/div&gt;
      );
    }
  
    render() {
      return (
        &lt;div&gt;
          &lt;h1&gt;Top Stories&lt;/h1&gt;
          {this.state.loading ?
            this.renderLoading()
            : this.renderPosts()}
        &lt;/div&gt;
      );
    }
  }
  
  var First1 = React.createClass({
      myClick: function(e){
          alert(e.currentTarget.getAttribute("data-city"));
          var city = e.currentTarget.getAttribute("data-city");
          //alert('Show 1');
           axios.get('https://newsapi.org/v1/articles?source=techcrunch&amp;&amp;sortBy='+city+'&amp;apiKey=789ea3cd651a49e5ba9fc2061d68138f')
        .then(res =&gt; {
           //console.log(res.data);
          // Transform the raw data by extracting the nested posts
          const posts = res.data.articles;
  
          //console.log(posts);
  
          // Update state to trigger a re-render.
          // Clear any errors, and turn off the loading indiciator.
          //console.log(posts);
          this.setState({
            posts,
            loading: false,
            error: null
          });
  
          //console.log(this.setState);
        })
        .catch(err =&gt; {
          // Something went wrong. Save the error in state and re-render.
          this.setState({
            loading: false,
            error: err
          });
        });
      },
      render: function() {
          return (&lt;div&gt;
                    &lt;a onClick={this.myClick} data-city="latest"&gt; Latest&lt;/a&gt;
                    &lt;a onClick={this.myClick} data-city="top"&gt; Top&lt;/a&gt;
                  &lt;/div&gt;
                 );
      }
  });
  
  
  
  // Change the subreddit to anything you like
  ReactDOM.render(
    &lt;FetchDemo subreddit="reactjs"/&gt;,
    document.getElementById('root')
  );
  </code></pre>
  
  <p>Here is link <a href="https://jsfiddle.net/69z2wepo/74393/" rel="nofollow noreferrer">https://jsfiddle.net/69z2wepo/74393/</a></p>