title: how to make api calls in reactjs new hook api and share that across components?
body: <p>How to call a restApi  in the new reactjs hook api. 
  And reusing the data using useEffects and useState ? 
  I want to just reuse the data across components.</p>
  
  <pre><code>import { useState, useEffect } from "react";
  export default function getAdvice(url) {
      fetch(`http://api.adviceslip.com/advice`)
          .then(res =&gt; res.json())
          .then(res =&gt; console.log(res))
          .catch(err =&gt; console.log(err)
  }
  </code></pre>