Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    ⚛React

    Components and JSX

    • Why React?
    • JSX rules
    • Props
    • Rendering lists and keys
    • Conditional rendering

    State and events

    • Handling events
    • useState: a component's memory
    • Objects and arrays in state
    • Forms and controlled inputs
    • Lifting state up

    Effects and essential hooks

    • useEffect
    • Fetching data
    • useRef
    • Context: data for the whole tree
    • useReducer

    Professional React

    • Writing your own hooks
    • Performance: memo, useMemo and useCallback
    • Suspense and error boundaries
    • What's new in React 19
    • Thinking in React
    • Project: a complete to-do app
    React

    Professional React · Lesson 19 of 21

    What's new in React 19

    Actions, useActionState, use, ref as a prop, and the Compiler.

    9 minutes1 games

    The preview here runs React 18 (the last version shipped as a single browser file), and everything you've learned works the same in React 19. But React 19 (December 2024) added important features you'll meet in Next.js and new projects, so these examples are for reading:

    Actions and useActionState

    React
    // A form whose action is an async function: React tracks pending state and errors
    function JoinForm() {
      const [error, submitAction, isPending] = useActionState(async (previous, formData) => {
        const res = await joinCourse(formData.get("email"))
        return res.ok ? null : res.message          // the new state
      }, null)
    
      return (
        <form action={submitAction}>
          <input name="email" type="email" required />
          <button disabled={isPending}>{isPending ? "Joining…" : "Join"}</button>
          {error && <p>{error}</p>}
        </form>
      )
    }

    <form action={fn}> now accepts an async function; React tracks the pending state and result, and resets the form on success. useOptimistic shows the expected result immediately (like a like) until the server responds.

    use, and ref as a prop

    React
    // use() reads a promise (suspending until it resolves) or a context, even inside an if
    function Comments({ commentsPromise }) {
      const comments = use(commentsPromise)
      return comments.map((c) => <p key={c.id}>{c.text}</p>)
    }
    
    // ref is a normal prop now: no more forwardRef
    function SearchInput({ ref, ...props }) {
      return <input ref={ref} {...props} />
    }
    BeforeReact 19

    onSubmit + useState(loading) + try/catch

    <form action={fn}> + useActionState

    forwardRef((props, ref) => …)

    function C({ ref }) { … }

    useContext(Ctx)

    use(Ctx) (works inside if)

    <Ctx.Provider value>

    <Ctx value>

    useMemo and useCallback by hand

    React Compiler adds them for you

    Important

    React Server Components are the biggest change: components that run only on the server, can query the database directly, and send no JavaScript to the browser. They run inside a framework like Next.js (App Router), the subject of the next track.

    Quick question

    In React 19, how do you pass a ref to your own component?

    Interview question

    What is the React Compiler, and do you still need useMemo?

    Learn more from

    • React blog: React 19react.dev
    • react.dev: useActionStatereact.dev
    • react.dev: usereact.dev
    • Next.js docs: Server and Client Componentsnextjs.org
    • react.dev: React Compilerreact.dev

    Played 0 of 1 games

    Sign in to save your progress and earn XP.

    PreviousSuspense and error boundariesNextThinking in React
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.