GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Combine ReactJSXElementValidator with main module by acdlite · Pull Request #28317 · react/react

Conversation

@acdlite

@acdlite acdlite commented Feb 13, 2024

Copy link
Copy Markdown
Collaborator

There are too many layers to the JSX runtime implementation. I think basically everything should be implemented in a single file, so that's what I'm going to do.

As a first step, this deletes ReactJSXElementValidator and moves all the code into ReactJSXElement. I can already see how this will help us remove more indirections in the future.

Next I'm going to do start moving the createElement runtime into this module as well, since there's a lot of duplicated code.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 13, 2024
@acdlite acdlite closed this Feb 13, 2024
@acdlite
acdlite force-pushed the inline-jsx-element-validator branch from f6f54b8 to 14fd963 Compare February 13, 2024 16:26
@acdlite acdlite reopened this Feb 13, 2024
@acdlite
acdlite marked this pull request as ready for review February 13, 2024 16:38
@acdlite
acdlite force-pushed the inline-jsx-element-validator branch from f6f54b8 to 6af435e Compare February 13, 2024 16:41
@react-sizebot

react-sizebot commented Feb 13, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: 015ff2e...881e029

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 176.83 kB 176.83 kB = 55.11 kB 55.11 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 178.83 kB 178.83 kB = 55.69 kB 55.69 kB
facebook-www/ReactDOM-prod.classic.js = 594.81 kB 594.81 kB = 104.91 kB 104.91 kB
facebook-www/ReactDOM-prod.modern.js = 578.10 kB 578.10 kB = 101.93 kB 101.93 kB
oss-experimental/react/cjs/react-jsx-runtime.react-server.production.min.js +2.49% 0.88 kB 0.91 kB +1.64% 0.55 kB 0.56 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.production.min.js +2.49% 0.88 kB 0.91 kB +1.64% 0.55 kB 0.56 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.production.min.js +2.49% 0.88 kB 0.91 kB +1.64% 0.55 kB 0.56 kB
test_utils/ReactAllWarnings.js Deleted 66.26 kB 0.00 kB Deleted 16.32 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react/cjs/react-jsx-runtime.react-server.production.min.js +2.49% 0.88 kB 0.91 kB +1.64% 0.55 kB 0.56 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.production.min.js +2.49% 0.88 kB 0.91 kB +1.64% 0.55 kB 0.56 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.production.min.js +2.49% 0.88 kB 0.91 kB +1.64% 0.55 kB 0.56 kB
oss-experimental/react/cjs/react-jsx-runtime.profiling.js +1.98% 4.08 kB 4.16 kB +2.08% 1.83 kB 1.87 kB
oss-stable-semver/react/cjs/react-jsx-runtime.profiling.js +1.98% 4.08 kB 4.16 kB +2.08% 1.83 kB 1.87 kB
oss-stable/react/cjs/react-jsx-runtime.profiling.js +1.98% 4.08 kB 4.16 kB +2.08% 1.83 kB 1.87 kB
oss-experimental/react/cjs/react-jsx-runtime.production.js +1.98% 4.08 kB 4.16 kB +2.02% 1.83 kB 1.87 kB
oss-stable-semver/react/cjs/react-jsx-runtime.production.js +1.98% 4.08 kB 4.16 kB +2.02% 1.83 kB 1.87 kB
oss-stable/react/cjs/react-jsx-runtime.production.js +1.98% 4.08 kB 4.16 kB +2.02% 1.83 kB 1.87 kB
oss-experimental/react/cjs/react-jsx-runtime.react-server.production.js +1.44% 4.17 kB 4.23 kB +0.96% 1.87 kB 1.89 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.production.js +1.44% 4.17 kB 4.23 kB +0.96% 1.87 kB 1.89 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.production.js +1.44% 4.17 kB 4.23 kB +0.96% 1.87 kB 1.89 kB
facebook-react-native/react/cjs/JSXRuntime-prod.js +0.42% 1.43 kB 1.43 kB = 0.70 kB 0.70 kB
facebook-react-native/react/cjs/JSXRuntime-profiling.js +0.42% 1.43 kB 1.43 kB = 0.70 kB 0.70 kB
facebook-react-native/react/cjs/JSXRuntime-dev.js +0.21% 41.09 kB 41.18 kB +0.05% 10.79 kB 10.79 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.development.js = 46.22 kB 45.66 kB = 13.47 kB 13.28 kB
oss-stable/react/cjs/react-jsx-dev-runtime.development.js = 46.22 kB 45.66 kB = 13.47 kB 13.28 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.development.js = 46.19 kB 45.63 kB = 13.46 kB 13.27 kB
facebook-www/JSXDEVRuntime-dev.classic.js = 54.17 kB 53.51 kB = 14.00 kB 13.80 kB
facebook-www/JSXDEVRuntime-dev.modern.js = 54.17 kB 53.51 kB = 14.00 kB 13.80 kB
facebook-react-native/react/cjs/JSXDEVRuntime-dev.js = 40.43 kB 39.77 kB = 10.60 kB 10.41 kB
test_utils/ReactAllWarnings.js Deleted 66.26 kB 0.00 kB Deleted 16.32 kB 0.00 kB

Generated by 🚫 dangerJS against 881e029

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@acdlite
acdlite force-pushed the inline-jsx-element-validator branch from 6af435e to 4def47f Compare February 13, 2024 17:06
@acdlite
Combine ReactJSXElementValidator with main module
881e029
There are too many layers to the JSX runtime implementation. I think
basically everything should be implemented in a single file, so that's
what I'm going to do.

As a first step, this deletes ReactJSXElementValidator and moves all
the code into ReactJSXElement. I can already see how this will help
us remove more indirections in the future.

Next I'm going to do start moving the `createElement` runtime into
this module as well, since there's a lot of duplicated code.
@acdlite
acdlite force-pushed the inline-jsx-element-validator branch from 4def47f to 881e029 Compare February 13, 2024 17:28
This was referenced Feb 13, 2024
Combine createElement and JSX modules #28320
Merged
Remove string refs (behind flag) #28322
Merged
gnoff
gnoff reviewed Feb 14, 2024
View reviewed changes
Comment thread packages/react/src/jsx/ReactJSXServer.js
const jsxDEV: any = __DEV__ ? _jsxDEV : undefined;

export {REACT_FRAGMENT_TYPE as Fragment, jsx, jsxs};
export {REACT_FRAGMENT_TYPE as Fragment, jsx, jsxs, jsxDEV};

@gnoff gnoff Feb 14, 2024

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we weren't going to support jsxDEV in react-server. Maybe I misremembered or misunderstood?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@acdlite acdlite Feb 14, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just copy pasta, I'll fix

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sebmarkbage sebmarkbage Feb 19, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it doesn't really hurt as long as it's only in DEV. We're not hard deprecating the transform. It's just unnecessary and later we can hard deprecate.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

acdlite reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@acdlite acdlite mentioned this pull request Feb 16, 2024
Pass ref as normal prop #28348
Merged
sebmarkbage
sebmarkbage reviewed Feb 19, 2024
View reviewed changes
Comment thread packages/react/src/jsx/ReactJSXElement.js
"it's defined in, or you might have mixed up default and named imports.";
}

const sourceInfo = getSourceInfoErrorAddendum(source);

@sebmarkbage sebmarkbage Feb 19, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of the source should really go away completely.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@acdlite acdlite Feb 20, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll submit a separate PR to delete that

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
sebmarkbage
sebmarkbage reviewed Feb 19, 2024
View reviewed changes
Comment thread packages/react/src/jsx/ReactJSXElement.js
* @param {string} key
*/
export function jsxDEV(type, config, maybeKey, source, self) {
export function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {

@sebmarkbage sebmarkbage Feb 19, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the soon-to-be-gone-self warning, this shouldn't really be used anymore so the relationship should probably be the inverse where jsxDEV helper calls jsx or jsxs internally for backwards compat but doesn't have its own implementation.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@acdlite acdlite Feb 20, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that was how I started but since the implementation jsx and jsxs are identical in dev right now except for one branch, I was calling a shared function anyway and it ended up being about the same thing. But I'll keep this in mind. I think I can refactor this function so that check isn't so deep and we can get rid of the boolean argument. But I didn't want to do any extra refactoring in this initial PR to minimize the risk of an accidental behavior change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
sebmarkbage
sebmarkbage approved these changes Feb 19, 2024
View reviewed changes

@sebmarkbage sebmarkbage left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you find any discrepancies in the implementations that this changes?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@acdlite

acdlite commented Feb 20, 2024

Copy link
Copy Markdown
Collaborator Author

Did you find any discrepancies in the implementations that this changes?

No but I did find several instances of code that wasn't being used anywhere, as a result of the JSX runtime originally being a copy-paste of createElement. I'm guessing the code must have been shuffled around a few times in the original PR that landed it and nobody noticed. That was partly what motivated me to open this PR in the first place, because I kept getting confused by all the layering.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@acdlite
acdlite merged commit ec160f3 into react:main Feb 20, 2024
github-actions Bot pushed a commit that referenced this pull request Feb 20, 2024
@acdlite
Combine ReactJSXElementValidator with main module (#28317)
3b13b94
There are too many layers to the JSX runtime implementation. I think
basically everything should be implemented in a single file, so that's
what I'm going to do.

As a first step, this deletes ReactJSXElementValidator and moves all the
code into ReactJSXElement. I can already see how this will help us
remove more indirections in the future.

Next I'm going to do start moving the `createElement` runtime into this
module as well, since there's a lot of duplicated code.

DiffTrain build for [ec160f3](ec160f3)
acdlite added a commit that referenced this pull request Feb 20, 2024
@acdlite
Combine createElement and JSX modules (#28320)
5fb2c93
Depends on:

- #28317 

---

There's a ton of overlap between the createElement implementation and
the JSX implementation, so I combined them into a single module.

In the actual build output, the shared code between JSX and
createElement will get duplicated anyway, because react/jsx-runtime and
react (where createElement lives) are separate, flat build artifacts.

So this is more about code organization — with a few key exceptions, the
implementations of createElement and jsx are highly coupled.
github-actions Bot pushed a commit that referenced this pull request Feb 20, 2024
@acdlite
Combine createElement and JSX modules (#28320)
3f81ef2
Depends on:

- #28317

---

There's a ton of overlap between the createElement implementation and
the JSX implementation, so I combined them into a single module.

In the actual build output, the shared code between JSX and
createElement will get duplicated anyway, because react/jsx-runtime and
react (where createElement lives) are separate, flat build artifacts.

So this is more about code organization — with a few key exceptions, the
implementations of createElement and jsx are highly coupled.

DiffTrain build for [5fb2c93](5fb2c93)
acdlite added a commit that referenced this pull request Feb 20, 2024
@acdlite
Pass ref as normal prop (#28348)
fa2f82a
Depends on:

- #28317 
- #28320 

---

Changes the behavior of the JSX runtime to pass through `ref` as a
normal prop, rather than plucking it from the props object and storing
on the element.

This is a breaking change since it changes the type of the receiving
component. However, most code is unaffected since it's unlikely that a
component would have attempted to access a `ref` prop, since it was not
possible to get a reference to one.

`forwardRef` _will_ still pluck `ref` from the props object, though,
since it's extremely common for users to spread the props object onto
the inner component and pass `ref` as a differently named prop. This is
for maximum compatibility with existing code — the real impact of this
change is that `forwardRef` is no longer required.

Currently, refs are resolved during child reconciliation and stored on
the fiber. As a result of this change, we can move ref resolution to
happen only much later, and only for components that actually use them.
Then we can remove the `ref` field from the Fiber type. I have not yet
done that in this step, though.
github-actions Bot pushed a commit that referenced this pull request Feb 20, 2024
@acdlite
Pass ref as normal prop (#28348)
6479760
Depends on:

- #28317
- #28320

---

Changes the behavior of the JSX runtime to pass through `ref` as a
normal prop, rather than plucking it from the props object and storing
on the element.

This is a breaking change since it changes the type of the receiving
component. However, most code is unaffected since it's unlikely that a
component would have attempted to access a `ref` prop, since it was not
possible to get a reference to one.

`forwardRef` _will_ still pluck `ref` from the props object, though,
since it's extremely common for users to spread the props object onto
the inner component and pass `ref` as a differently named prop. This is
for maximum compatibility with existing code — the real impact of this
change is that `forwardRef` is no longer required.

Currently, refs are resolved during child reconciliation and stored on
the fiber. As a result of this change, we can move ref resolution to
happen only much later, and only for components that actually use them.
Then we can remove the `ref` field from the Fiber type. I have not yet
done that in this step, though.

DiffTrain build for [fa2f82a](fa2f82a)
This was referenced Feb 20, 2024
Bump vendored react versions vercel/next.js#62302
Closed
Upgrade vendored react vercel/next.js#62326
Merged
huozhi added a commit to vercel/next.js that referenced this pull request Feb 23, 2024
@huozhi
Upgrade vendored react (#62326)
e5d604f
### React upstream changes

- react/react#28333
- react/react#28334
- react/react#28378
- react/react#28377
- react/react#28376
- react/react#28338
- react/react#28331
- react/react#28336
- react/react#28320
- react/react#28317
- react/react#28375
- react/react#28367
- react/react#28380
- react/react#28368
- react/react#28343
- react/react#28355
- react/react#28374
- react/react#28362
- react/react#28344
- react/react#28339
- react/react#28353
- react/react#28346
- react/react#25790
- react/react#28352
- react/react#28326
- react/react#27688
- react/react#28329
- react/react#28332
- react/react#28340
- react/react#28327
- react/react#28325
- react/react#28324
- react/react#28309
- react/react#28310
- react/react#28307
- react/react#28306
- react/react#28315
- react/react#28318
- react/react#28226
- react/react#28308
- react/react#27563
- react/react#28297
- react/react#28286
- react/react#28284
- react/react#28275
- react/react#28145
- react/react#28301
- react/react#28224
- react/react#28152
- react/react#28296
- react/react#28294
- react/react#28279
- react/react#28273
- react/react#28269
- react/react#28376
- react/react#28338
- react/react#28331
- react/react#28336
- react/react#28320
- react/react#28317
- react/react#28375
- react/react#28367
- react/react#28380
- react/react#28368
- react/react#28343
- react/react#28355
- react/react#28374
- react/react#28362
- react/react#28344
- react/react#28339
- react/react#28353
- react/react#28346
- react/react#25790
- react/react#28352
- react/react#28326
- react/react#27688
- react/react#28329
- react/react#28332
- react/react#28340
- react/react#28327
- react/react#28325
- react/react#28324
- react/react#28309
- react/react#28310
- react/react#28307
- react/react#28306
- react/react#28315
- react/react#28318
- react/react#28226
- react/react#28308
- react/react#27563
- react/react#28297
- react/react#28286
- react/react#28284
- react/react#28275
- react/react#28145
- react/react#28301
- react/react#28224
- react/react#28152
- react/react#28296
- react/react#28294
- react/react#28279
- react/react#28273
- react/react#28269

Closes NEXT-2542


Disable ppr test for strict mode for now, @acdlite will check it and
we'll sync again
@ztanner ztanner mentioned this pull request Mar 19, 2024
(backport) Update React from 60a927d04 to 14898b6a9 vercel/next.js#63442
Closed
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@acdlite @AndyPengc12
Combine ReactJSXElementValidator with main module (react#28317)
d068d43
There are too many layers to the JSX runtime implementation. I think
basically everything should be implemented in a single file, so that's
what I'm going to do.

As a first step, this deletes ReactJSXElementValidator and moves all the
code into ReactJSXElement. I can already see how this will help us
remove more indirections in the future.

Next I'm going to do start moving the `createElement` runtime into this
module as well, since there's a lot of duplicated code.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@acdlite @AndyPengc12
Combine createElement and JSX modules (react#28320)
8121686
Depends on:

- react#28317 

---

There's a ton of overlap between the createElement implementation and
the JSX implementation, so I combined them into a single module.

In the actual build output, the shared code between JSX and
createElement will get duplicated anyway, because react/jsx-runtime and
react (where createElement lives) are separate, flat build artifacts.

So this is more about code organization — with a few key exceptions, the
implementations of createElement and jsx are highly coupled.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@acdlite @AndyPengc12
Pass ref as normal prop (react#28348)
8114ce2
Depends on:

- react#28317 
- react#28320 

---

Changes the behavior of the JSX runtime to pass through `ref` as a
normal prop, rather than plucking it from the props object and storing
on the element.

This is a breaking change since it changes the type of the receiving
component. However, most code is unaffected since it's unlikely that a
component would have attempted to access a `ref` prop, since it was not
possible to get a reference to one.

`forwardRef` _will_ still pluck `ref` from the props object, though,
since it's extremely common for users to spread the props object onto
the inner component and pass `ref` as a differently named prop. This is
for maximum compatibility with existing code — the real impact of this
change is that `forwardRef` is no longer required.

Currently, refs are resolved during child reconciliation and stored on
the fiber. As a result of this change, we can move ref resolution to
happen only much later, and only for components that actually use them.
Then we can remove the `ref` field from the Fiber type. I have not yet
done that in this step, though.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
@acdlite
Combine ReactJSXElementValidator with main module (#28317)
163b2f0
There are too many layers to the JSX runtime implementation. I think
basically everything should be implemented in a single file, so that's
what I'm going to do.

As a first step, this deletes ReactJSXElementValidator and moves all the
code into ReactJSXElement. I can already see how this will help us
remove more indirections in the future.

Next I'm going to do start moving the `createElement` runtime into this
module as well, since there's a lot of duplicated code.

DiffTrain build for commit ec160f3.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
@acdlite
Combine createElement and JSX modules (#28320)
2579855
Depends on:

- #28317

---

There's a ton of overlap between the createElement implementation and
the JSX implementation, so I combined them into a single module.

In the actual build output, the shared code between JSX and
createElement will get duplicated anyway, because react/jsx-runtime and
react (where createElement lives) are separate, flat build artifacts.

So this is more about code organization — with a few key exceptions, the
implementations of createElement and jsx are highly coupled.

DiffTrain build for commit 5fb2c93.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
@acdlite
Pass ref as normal prop (#28348)
c25dcdb
Depends on:

- #28317
- #28320

---

Changes the behavior of the JSX runtime to pass through `ref` as a
normal prop, rather than plucking it from the props object and storing
on the element.

This is a breaking change since it changes the type of the receiving
component. However, most code is unaffected since it's unlikely that a
component would have attempted to access a `ref` prop, since it was not
possible to get a reference to one.

`forwardRef` _will_ still pluck `ref` from the props object, though,
since it's extremely common for users to spread the props object onto
the inner component and pass `ref` as a differently named prop. This is
for maximum compatibility with existing code — the real impact of this
change is that `forwardRef` is no longer required.

Currently, refs are resolved during child reconciliation and stored on
the fiber. As a result of this change, we can move ref resolution to
happen only much later, and only for components that actually use them.
Then we can remove the `ref` field from the Fiber type. I have not yet
done that in this step, though.

DiffTrain build for commit fa2f82a.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@acdlite
Combine ReactJSXElementValidator with main module (react#28317)
330e1d8
There are too many layers to the JSX runtime implementation. I think
basically everything should be implemented in a single file, so that's
what I'm going to do.

As a first step, this deletes ReactJSXElementValidator and moves all the
code into ReactJSXElement. I can already see how this will help us
remove more indirections in the future.

Next I'm going to do start moving the `createElement` runtime into this
module as well, since there's a lot of duplicated code.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@acdlite
Combine createElement and JSX modules (react#28320)
35619d7
Depends on:

- react#28317 

---

There's a ton of overlap between the createElement implementation and
the JSX implementation, so I combined them into a single module.

In the actual build output, the shared code between JSX and
createElement will get duplicated anyway, because react/jsx-runtime and
react (where createElement lives) are separate, flat build artifacts.

So this is more about code organization — with a few key exceptions, the
implementations of createElement and jsx are highly coupled.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@acdlite
Pass ref as normal prop (react#28348)
2770749
Depends on:

- react#28317 
- react#28320 

---

Changes the behavior of the JSX runtime to pass through `ref` as a
normal prop, rather than plucking it from the props object and storing
on the element.

This is a breaking change since it changes the type of the receiving
component. However, most code is unaffected since it's unlikely that a
component would have attempted to access a `ref` prop, since it was not
possible to get a reference to one.

`forwardRef` _will_ still pluck `ref` from the props object, though,
since it's extremely common for users to spread the props object onto
the inner component and pass `ref` as a differently named prop. This is
for maximum compatibility with existing code — the real impact of this
change is that `forwardRef` is no longer required.

Currently, refs are resolved during child reconciliation and stored on
the fiber. As a result of this change, we can move ref resolution to
happen only much later, and only for components that actually use them.
Then we can remove the `ref` field from the Fiber type. I have not yet
done that in this step, though.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gnoff gnoff gnoff left review comments
+1 more reviewer
@sebmarkbage sebmarkbage sebmarkbage approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@acdlite @react-sizebot @sebmarkbage @gnoff @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.