Status After Block

Let’s look at the preview on the bottom right, we’ll notice that it is not displaying anything. This is because we haven’t yet implemented the useWaitForBlock hook in our React application.

To address this, we’ll call the useWaitForBlock hook to handle the fetch call in the editor on the top right.

import {useWaitForBlock} from '@awesome-algorand/react-query'
export function WaitForBlockViewer(){
const data = {round: 1}
const query = useWaitForBlock(data)
if(query.isLoading) return <div>Loading...</div>
if(query.isError) return <div>Error: {query.error.message}</div>
return (
<div>
<h2>Time Since Last Round: {query.data["time-since-last-round"]}</h2>
<h2>Last Round: {query.data["last-round"]}</h2>
</div>
)
}
Files
Preparing Environment
  • Installing dependencies
  • Cleaning up packages
  • Injecting workspace packages
  • Starting http server