React
migration
byCodemod

React/19/Use Context Hook

/icons/badge-info.svg

Made for

React

/icons/calendar.svg

Last update

Jul 24, 2024

This codemod will convert the usage of useContext to the new hook format, introduced in React v19.

Example

Before:

import { useContext } from "react";
import UseTheme from "./UseTheme";
const theme = useContext(UseTheme);

After:

import { use } from "react";
import UseTheme from "./UseTheme";
const theme = use(UseTheme);

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now