From 383b389878052657550b4887d0323f6f7026bce5 Mon Sep 17 00:00:00 2001 From: Dixita Ganatra Date: Thu, 20 Feb 2025 04:31:18 +0530 Subject: [PATCH 1/3] Remove forwardRefs from recap and challenges (#7475) --- .../learn/manipulating-the-dom-with-refs.md | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/content/learn/manipulating-the-dom-with-refs.md b/src/content/learn/manipulating-the-dom-with-refs.md index e366ea7cc0..2053f936b3 100644 --- a/src/content/learn/manipulating-the-dom-with-refs.md +++ b/src/content/learn/manipulating-the-dom-with-refs.md @@ -647,7 +647,7 @@ However, this doesn't mean that you can't do it at all. It requires caution. **Y - Refs are a generic concept, but most often you'll use them to hold DOM elements. - You instruct React to put a DOM node into `myRef.current` by passing `
`. - Usually, you will use refs for non-destructive actions like focusing, scrolling, or measuring DOM elements. -- A component doesn't expose its DOM nodes by default. You can opt into exposing a DOM node by using `forwardRef` and passing the second `ref` argument down to a specific node. +- A component doesn't expose its DOM nodes by default. You can opt into exposing a DOM node by using the `ref` prop. - Avoid changing DOM nodes managed by React. - If you do modify DOM nodes managed by React, modify parts that React has no reason to update. @@ -1049,7 +1049,7 @@ Make it so that clicking the "Search" button puts focus into the field. Note tha -You'll need `forwardRef` to opt into exposing a DOM node from your own component like `SearchInput`. +You'll need to pass `ref` as a prop to opt into exposing a DOM node from your own component like `SearchInput`. @@ -1134,18 +1134,14 @@ export default function SearchButton({ onClick }) { ``` ```js src/SearchInput.js -import { forwardRef } from 'react'; - -export default forwardRef( - function SearchInput(props, ref) { - return ( - - ); - } -); +export default function SearchInput({ ref }) { + return ( + + ); +} ``` ```css From 6ef277aab1e5f0bbbe45c4f514a32f32e100c43e Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Wed, 19 Feb 2025 22:03:46 -0800 Subject: [PATCH 2/3] Update CRA to Parcel migration guide (#7638) --- src/content/blog/2025/02/14/sunsetting-create-react-app.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/blog/2025/02/14/sunsetting-create-react-app.md b/src/content/blog/2025/02/14/sunsetting-create-react-app.md index af1b8a7dcb..9ced6231c3 100644 --- a/src/content/blog/2025/02/14/sunsetting-create-react-app.md +++ b/src/content/blog/2025/02/14/sunsetting-create-react-app.md @@ -66,7 +66,7 @@ If your app has unusual constraints, or you prefer to solve these problems by bu For existing apps, these guides will help you migrate to a build tool: * [Vite Create React App migration guide](https://www.robinwieruch.de/vite-create-react-app/) -* [Parcel Create React App migration guide](https://stackoverflow.com/a/49605484) +* [Parcel Create React App migration guide](https://parceljs.org/migration/cra/) * [Rsbuild Create React App migration guide](https://rsbuild.dev/guide/migration/cra) To help get started with Vite, Parcel or Rsbuild, we've added new docs for [Building a React App from Scratch](/learn/build-a-react-app-from-scratch). From a42121e4793f3144a2f00b5862de974bc2da87a3 Mon Sep 17 00:00:00 2001 From: Joonyoung Hong Date: Fri, 21 Feb 2025 03:59:42 +0900 Subject: [PATCH 3/3] fix: correct typo in hydrateRoot.md (#7637) --- src/content/reference/react-dom/client/hydrateRoot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react-dom/client/hydrateRoot.md b/src/content/reference/react-dom/client/hydrateRoot.md index 887cab7d27..ca4708845f 100644 --- a/src/content/reference/react-dom/client/hydrateRoot.md +++ b/src/content/reference/react-dom/client/hydrateRoot.md @@ -400,7 +400,7 @@ The onCaughtError option is a function called with 1. The error that was thrown. 2. An errorInfo object that contains the componentStack of the error. -Together with `onUncaughtError` and `onRecoverableError`, you can can implement your own error reporting system: +Together with `onUncaughtError` and `onRecoverableError`, you can implement your own error reporting system: