Skip to content

Instantly share code, notes, and snippets.

@HazemBZ
Last active March 27, 2024 13:20
Show Gist options
  • Select an option

  • Save HazemBZ/c7a579a0ba8a903c5e2aa16e9be24dc3 to your computer and use it in GitHub Desktop.

Select an option

Save HazemBZ/c7a579a0ba8a903c5e2aa16e9be24dc3 to your computer and use it in GitHub Desktop.
migrate --> react18

upgrade packages

use npm-check-updates package

Fix react children

for children with props

npx types-react-codemod preset-18 ./src

case importing named objects search and replace using this (regex)

find line:

(.*)React.(PropsWithChildren.*)

replace line

import {PropsWithChildren}
from 'react'
$1$2

linter will removes import duplicates

npm run lint:fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment