Hey,
In the last post, I talked about the use hook RFC. In today's post, I will share a code example.
const PostsList = () => {
const posts = use(fifoPostsAPI.get())
return (<div>
{posts.map(post => (<p id={post.id}>{post.name}</p>))}
</div>)
}
In the code snippet above, just like await, use effectively unwraps the value of the Promise returned by our fifoPostsAPI. Unlike await however, the execution of the component is not actually resumed from the same place when the Promise is resolved.
Instead, use throws an exception, just like React.Suspense to interrupt the rendering. When the promise resolves, the component is re-rendered:
So that's how it will be implemented. Hope you had fun reading this. Have a great day ahead. See you later, alligator! 🐊
AutoRegex: An AI tool that can write your Regex Hi, Hope you are having a terrific day. As a developer, one of the most excruciating things that I have to do from time to time is writing Regular Expressions. The amount of time that I have spent on just writing Regex is insane. I was working on a project recently where I had to write some Regex and I wondered if there was an AI tool to help me. To my surprise, there was. One of those tools is called AutoRegex.xyz
The ins and outs of Cloud Storage, what is it, and the reasons behind the current pricing model (Part -1) Hello everyone, Today, I wanted to cover some basics of cloud storage. So let me casually throw away the most basic definition first.