useEffect(() => {
getRandomJoke();
addJoke()
}, []);
const [jokes, setJokes] = React.useState([]);
Первый компонент
useEffect(() => {
fetch("https://api.chucknorris.io/jokes/random?category=animal")
.then((res) => res.json())
.then((data) => setJoke(() => [...joke, data.value]);
}, []);
Второй компотнент
useEffect(() => {
fetch("https://api.chucknorris.io/jokes/random?category=sport")
.then((res) => res.json())
.then((data) => setJoke(data.value));
}, []);