<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: CristianCuartas</title>
    <description>The latest articles on DEV Community by CristianCuartas (@cristiancuartas).</description>
    <link>https://dev.to/cristiancuartas</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F172755%2Fd176502d-488d-4f64-9665-37fc45154b44.png</url>
      <title>DEV Community: CristianCuartas</title>
      <link>https://dev.to/cristiancuartas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cristiancuartas"/>
    <language>en</language>
    <item>
      <title>Pass a state from one class to another class in REACT JS.</title>
      <dc:creator>CristianCuartas</dc:creator>
      <pubDate>Tue, 11 Jun 2019 13:34:20 +0000</pubDate>
      <link>https://dev.to/cristiancuartas/ass-a-state-from-one-class-to-another-class-in-react-js-4l9c</link>
      <guid>https://dev.to/cristiancuartas/ass-a-state-from-one-class-to-another-class-in-react-js-4l9c</guid>
      <description>&lt;p&gt;Hello, I need to pass a state from one class to another class.&lt;/p&gt;

&lt;p&gt;Can I do it with a callback?&lt;/p&gt;

&lt;p&gt;You help me?&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
class SearchNav extends Component {&lt;br&gt;
  constructor(props) {&lt;br&gt;
    super(props);&lt;br&gt;
    this.state = {&lt;br&gt;
      q: '',&lt;br&gt;
      param: {},&lt;br&gt;
      getData: []&lt;br&gt;
    };&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;getDataSearch = () =&amp;gt; {&lt;br&gt;
    fetch(url + &lt;code&gt;${this.state.q}&lt;/code&gt;)&lt;br&gt;
      .then(res =&amp;gt; res.json())&lt;br&gt;
      .then(data =&amp;gt; {&lt;br&gt;
        this.setState({ getData: data.hits });&lt;br&gt;
        console.log(this.state.getData);&lt;br&gt;
      })&lt;br&gt;
      .catch(Error =&amp;gt; {&lt;br&gt;
        console.log(Error);&lt;br&gt;
      });&lt;br&gt;
  };&lt;br&gt;
...&lt;br&gt;
I need pass state =&amp;gt;'getData' to other class.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>props</category>
    </item>
  </channel>
</rss>
