From bbef436859b4939ba22fea805cb22ef09dbe77c2 Mon Sep 17 00:00:00 2001 From: mdimamhosen Date: Sat, 5 Sep 2026 02:09:11 +0600 Subject: [PATCH] docs(warnings): update special-props warning for React 19 ref prop forwarding --- src/content/warnings/special-props.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/content/warnings/special-props.md b/src/content/warnings/special-props.md index 1646b531a2c..4d7ad5f16e8 100644 --- a/src/content/warnings/special-props.md +++ b/src/content/warnings/special-props.md @@ -2,6 +2,8 @@ title: Special Props Warning --- -Most props on a JSX element are passed on to the component, however, there are two special props (`ref` and `key`) which are used by React, and are thus not forwarded to the component. +Most props on a JSX element are passed on to the component. In earlier versions of React, `key` and `ref` were two special props used internally by React that were not forwarded to components. -For instance, you can't read `props.key` from a component. If you need to access the same value within the child component, you should pass it as a different prop (ex: `` and read `props.id`). While this may seem redundant, it's important to separate app logic from hints to React. +Starting in React 19, `ref` is available as a prop for function components, making `key` the only prop that React does not forward to the component. + +For instance, you cannot read `props.key` from a component. If you need to access the same value within the child component, you should pass it as a different prop (e.g. `` and read `props.id`). While this may seem redundant, it's important to separate app logic from hints to React.