> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a React 18 to 19 Upgrade Playbook

export const UseCaseHero = ({title, description, prompt, category, features, devinUrl, agent, intent, playbookId, type}) => {
  const encodedPrompt = encodeURIComponent(prompt || '');
  const tag = 'docs-use-case-gallery';
  const utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=hero-cta';
  const agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  const devinHref = type === 'schedule' ? 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + (prompt ? '&prompt=' + encodedPrompt : '') : type === 'review' ? 'https://app.devin.ai/review?' + utm : agent === 'ada' ? 'https://app.devin.ai/search?' + utm + '&noSubmit=true' + (prompt ? '&prompt=' + encodedPrompt : '') : devinUrl ? devinUrl.includes('?') ? devinUrl + '&' + utm + agentParams : devinUrl + '?' + utm + agentParams : prompt ? 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encodedPrompt : 'https://app.devin.ai/?' + utm + agentParams;
  const buttonLabel = type === 'schedule' ? 'Schedule in Devin ↗' : type === 'review' ? 'Set Up Devin Review ↗' : agent === 'advanced' ? 'Try in Devin ↗' : agent === 'dana' ? 'Try in Dana ↗' : agent === 'ada' ? 'Try in Ask Devin ↗' : 'Try in Devin ↗';
  const featureList = features ? features.split(',').map(f => f.trim()) : [];
  return <div className="uc-hero">
      <div className="uc-hero-inner">
        <div className="uc-hero-left">
          <h1 className="uc-hero-title">{title}</h1>
          <p className="uc-hero-desc">{description}</p>
          <div>
            <a href={devinHref} target="_blank" rel="noopener noreferrer" className="try-in-devin-btn">
              {buttonLabel}
            </a>
          </div>
        </div>
        <div className="uc-hero-meta">
          <div className="uc-meta-item">
            <span className="uc-meta-label">Author</span>
            <span className="uc-meta-value">Cognition</span>
          </div>
          <div className="uc-meta-item">
            <span className="uc-meta-label">Category</span>
            <span className="uc-meta-value">{category}</span>
          </div>
          {featureList.length > 0 && <div className="uc-meta-item">
              <span className="uc-meta-label">Features</span>
              <span className="uc-meta-value">{featureList.join(', ')}</span>
            </div>}
        </div>
      </div>
    </div>;
};

export const PromptBlock = ({children, type, agent, intent, playbookId}) => {
  var utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=prompt-block';
  var tag = 'docs-use-case-gallery';
  var agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  var label = type === 'schedule' ? 'Schedule in Devin' : type === 'playbook' ? 'Create Playbook' : type === 'knowledge' ? 'Add to Knowledge' : agent === 'advanced' ? 'Try in Devin' : agent === 'dana' ? 'Try in Dana' : agent === 'ada' ? 'Try in Ask Devin' : 'Try in Devin';
  var buildUrl = function (text) {
    var encoded = encodeURIComponent(text);
    if (type === 'schedule') return 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + '&prompt=' + encoded;
    if (type === 'playbook') return 'https://app.devin.ai/settings/playbooks/create?' + utm + '&body=' + encoded;
    if (type === 'knowledge') return 'https://app.devin.ai/knowledge?' + utm + '&body=' + encoded;
    if (agent === 'ada') return 'https://app.devin.ai/search?' + utm + '&noSubmit=true&prompt=' + encoded;
    return 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encoded;
  };
  const ref = React.useRef(null);
  const [href, setHref] = React.useState('#');
  React.useEffect(() => {
    if (!ref.current) return;
    var codeEl = ref.current.querySelector('pre code');
    if (codeEl) {
      var text = codeEl.textContent.trim();
      if (text) setHref(buildUrl(text));
    }
    var header = ref.current.querySelector('[data-component-part="code-block-header"]');
    if (header && !header.querySelector('.prompt-block-devin-link')) {
      var link = document.createElement('a');
      link.href = href;
      link.target = '_blank';
      link.rel = 'noopener noreferrer';
      link.className = 'prompt-block-devin-link';
      link.style.cssText = 'display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:#fff;font-size:11px;font-weight:500;padding:4px 10px;border-radius:6px;white-space:nowrap;background:#317CFF;transition:background 0.2s;margin-left:8px;';
      link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> ' + label;
      link.onmouseenter = function () {
        link.style.background = '#2968D9';
      };
      link.onmouseleave = function () {
        link.style.background = '#317CFF';
      };
      header.appendChild(link);
    }
    var existingLink = ref.current.querySelector('.prompt-block-devin-link');
    if (existingLink && href !== '#') existingLink.href = href;
  });
  return <div className="prompt-block" ref={ref}>{children}</div>;
};

<UseCaseHero title="Create a React 18 to 19 Upgrade Playbook" description="Turn the official React 19 upgrade guide into a phased playbook mapped to your codebase." prompt="Read the React 19 upgrade guide at https://react.dev/blog/2024/04/25/react-19-upgrade-guide and our React app. Build a migration playbook that maps every breaking change to our code — which files use removed APIs, what needs the new JSX transform, and how to phase the upgrade so we can ship incrementally." category="Migrations" features="Advanced, Playbooks" agent="advanced" intent="create" />

<div className="uc-detail-wrapper">
  <Tip>Don't want to set this up manually? Paste a link to this page into a Devin session and ask it to set everything up for you.</Tip>

  <Steps>
    <Step title="Prompt Devin with the React 19 upgrade guide">
      React 19 introduces breaking changes across ref handling, context usage, TypeScript types, and removed legacy APIs. The [official upgrade guide](https://react.dev/blog/2024/04/25/react-19-upgrade-guide) documents every change, but the hard part is mapping those changes to *your* code. Instead of reading the guide yourself and auditing every component, hand both to Devin and get back a playbook scoped to your actual files.

      Open a new Devin session from the [Devin home page](https://app.devin.ai/?utm_source=docs\&utm_medium=use-case-gallery) and paste a prompt with the upgrade guide URL and what you need:

      <PromptBlock agent="advanced">
        ```txt Build React 18→19 upgrade playbook theme={null}
        We're upgrading our React app from v18 to v19.
        Here's the official upgrade guide:
        https://react.dev/blog/2024/04/25/react-19-upgrade-guide

        Build a migration playbook specific to our codebase:
        - Install react@18.3 first and fix every deprecation warning
          before touching v19
        - Find all uses of forwardRef and plan the ref-as-prop migration
        - Identify components using the legacy Context API (contextTypes,
          getChildContext) that need conversion to createContext
        - Flag any string ref usage or legacy lifecycle methods
        - List TypeScript files that need updated ref types
          (e.g., removing RefObject in favor of RefObject | null)
        - Order the steps so we can ship incrementally — deprecation
          fixes first, then API removals, then new features
        - Include a validation step after each phase
        ```
      </PromptBlock>
    </Step>

    <Step title="Layer in codebase-specific context">
      Devin uses [DeepWiki](/work-with-devin/deepwiki) to understand your repo's architecture automatically. It can also look up online sources about React 19 — the official upgrade guide, blog posts, library changelogs — and incorporate what it finds directly into the playbook.

      To make the playbook even sharper, tell Devin about patterns the migration will touch:

      * *"We use `forwardRef` in 23 components under `src/components/ui/` — these are our design system primitives"*
      * *"We still have 4 class components in `src/legacy/` that use string refs and `componentWillMount`"*
      * *"Check other repos in our org (e.g., `acme/design-system`, `acme/admin-dashboard`) to see if they've already started the React 19 migration — reuse any patterns they've established"*

      If any dependencies have their own React 19 compatibility guides (e.g., React Router, React Hook Form, or your UI library), paste those URLs into the prompt too — Devin reads them all and cross-references the breaking changes.
    </Step>

    <Step title="Review the codebase-specific playbook">
      Devin reads the React 19 upgrade guide end-to-end, cross-references every breaking change against your codebase via [DeepWiki](/work-with-devin/deepwiki), and produces a phased playbook with specific files, complexity estimates, and validation steps:

      ```markdown theme={null}
      # React 18 → 19 Migration Playbook

      ## Phase 1: Upgrade to React 18.3 and fix deprecation warnings (S)
      - npm install react@18.3 react-dom@18.3
      - Run the app and fix all console deprecation warnings:
        - Remove string refs in src/legacy/OldModal.tsx, src/legacy/OldTooltip.tsx
        - Replace ReactDOM.findDOMNode in src/legacy/DropdownMenu.tsx
      - Run test suite to confirm no regressions
      - Validation: Zero deprecation warnings in dev console, all tests pass

      ## Phase 2: Migrate forwardRef to ref-as-prop (M)
      - Remove forwardRef wrappers from 23 components in src/components/ui/:
        - Button.tsx, Input.tsx, Select.tsx, TextArea.tsx (high usage)
        - Modal.tsx, Popover.tsx, Tooltip.tsx (medium usage)
        - +16 more components (full list below)
      - Pass ref as a regular prop instead of wrapping in forwardRef
      - Update TypeScript types: change RefObject<T> to RefObject<T> | null
      - Update src/types/refs.d.ts to match new React 19 ref semantics
      - Validation: All ref-forwarding components render, focus management works

      ## Phase 3: Remove deprecated APIs (M)
      - Replace legacy Context (contextTypes/getChildContext) in:
        - src/legacy/ThemeProvider.tsx → already uses createContext (no change)
        - src/legacy/LocaleContext.tsx → convert to createContext pattern
      - Remove propTypes from 12 files (TypeScript handles validation)
      - Remove defaultProps from function components (use JS defaults)
      - Validation: Context values propagate correctly, no runtime warnings

      ## Phase 4: Update data fetching and Suspense patterns (L)
      - Review Suspense boundaries in src/components/layouts/
      - Update any components relying on fallback behavior changes
      - Test lazy-loaded routes in src/routes/ with new Suspense semantics
      - Validation: All lazy routes load, loading states render correctly

      ## Phase 5: Install React 19 and adopt new features (M)
      - npm install react@19 react-dom@19
      - Replace useFormState with useActionState in src/hooks/useFormField.ts
      - Update react-dom imports: ReactDOM.render → already using createRoot
      - Enable the new JSX transform if not already active
      - Validation: Full test suite passes, app runs without errors

      ## Phase 6: Update third-party libraries (L)
      - react-hook-form → upgrade to v8 (React 19 compatible)
      - @radix-ui/react-* → upgrade to latest (ref-as-prop support)
      - react-router-dom → verify v6.4+ compatibility
      - Validation: Forms submit correctly, UI primitives render, routing works

      ## Risks
      - forwardRef removal is highest-volume change — 23 components, many
        consumed by other teams
      - TypeScript ref type changes may surface null-safety issues
      - react-hook-form v8 has its own breaking changes — test form
        validation thoroughly
      ```

      The playbook is a plan, not an executed migration. Review it with your team, adjust the phasing or scope, then decide how to execute.
    </Step>

    <Step title="Execute and scale">
      Once the playbook looks right, save it and attach it to a session to execute phase by phase:

      <PromptBlock>
        ```txt Execute the React 19 migration playbook theme={null}
        Start executing the migration playbook, beginning with Phase 1
        (upgrade to React 18.3 and fix deprecation warnings). After each
        phase, run the dev server and full test suite. Only move to the
        next phase if everything passes. Open a PR when complete.
        ```
      </PromptBlock>

      **Scale across repos** — If you have multiple React apps that need the same upgrade, ask Devin to run the saved playbook across all of them in parallel using [managed Devins](/work-with-devin/advanced-capabilities#managed-devins).
    </Step>
  </Steps>
</div>
