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.
import { useState, useEffect } from "react";
export default function getAdvice(url) {
fetch(`http://api.adviceslip.com/advice`)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.log(err)
}