Today I start "The Ultimate React Course 2024: React, Redux & More" by Jonas Schmedtmann on Udemy. I will share a detailed blog post on everything I learned in the course.
import { useEffect, useState } from "react";
export default function App() {
const [advice, setAdvice] = useState("");
const [count, setCount] = useState(0);
useEffect(function () {
getAdvice();
}, []);
async function getAdvice() {
const res = await fetch("https://api.adviceslip.com/advice");
const data = await res.json();
setAdvice(data.slip.advice);
setCount((a) => a + 1);
}
return (
<div>
<h1>{advice}</h1>
<button onClick={getAdvice}>Get Advice</button>
<Message count={count} />
</div>
);
}
function Message(props) {
<p>
You have read <strong>{props.count}</strong> pieces of advice
</p>;
}
_**
####
**_
Top comments (5)
Don't learn redux. If you want to learn state management in client-side rendered SPAs, learn something like Jotai or Zustand, but tbh managing global state on the client is no longer necessary since server-side rendering and react server components let you fetch the data you need on the server, without doing round trips and making a giant redux store on the client.
Thank you. I will look into that
Can you also please, keep explanations. I want to learn too. Happy learning ❤️
we can stay connected, share learning
https://www.linkedin.com/in/season-shrestha-b11125207?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=ios_app
Hey.
I followed you on linkedin. Looking forward to learning with you
linkedin.com/in/banelempofu/
🔥💖