DEV Community

Nurbek Aliqo'ziyev
Nurbek Aliqo'ziyev

Posted on

๐Ÿš€ React 19 just changed the game: Goodbye useEffect, hello use()!

React 19 introduces use(), a powerful new hook that lets you:
โœ… Await promises directly inside your components
โœ… Skip useEffect, useState, and loading state logic
โœ… Let handle loading UI automatically
โœ… Throw errors directly โ€” React catches them via Error Boundaries

๐Ÿ”ฅ Example:

import { use } from 'react';

const getUser = () => fetch('/api/user').then(res => res.json());

export default function UserComponent() {
  const user = use(getUser());
  return <p>Hello, {user.name}</p>;
}

Enter fullscreen mode Exit fullscreen mode
<Suspense fallback={<p>Loading...</p>}>
  <UserComponent />
</Suspense>

Enter fullscreen mode Exit fullscreen mode

๐Ÿง  Important: use() is mainly for data fetching (GET). For user interactions like forms, buttons, and POST requests, youโ€™ll still use useState, onSubmit, etc.

*React is now more declarative, cleaner, and less error-prone than ever.
No more loading flags, boilerplate code, or side-effect spaghetti. Just readable, modern React. ๐Ÿงผ *

Top comments (1)

Collapse
 
thunder6230 profile image
thunder6230

Usequery