Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: div: ref is not a prop #30367

Open
SaintPepsi opened this issue Jul 17, 2024 · 3 comments
Open

Bug: div: ref is not a prop #30367

SaintPepsi opened this issue Jul 17, 2024 · 3 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@SaintPepsi
Copy link

SaintPepsi commented Jul 17, 2024

Using Vite & React we're getting the weirdest error i've seen in all my react career:

Warning: div: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)

I'm clueless, how does react warn me that ref is not a prop for <div>?

Accompanied is a whole bunch of other errors related to contexts:

Warning: _RichTextEditor: `key` is not a prop.
Warning: Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?
Warning: Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?

React version: 18.3.1

Steps To Reproduce

We tried to reproduce it but it does not happen in a minimal example.
Please advice on tactics/methods to write a minimal reproducible to try and get this error.

The component giving this error is rendering a createPortal to the document.body:

image

Large Node Tree With recursively rendered components and form elements just to show it's a complex application which I think is what contributes to why we can't replicated it.

image

Link to code example: WIP

The current behavior

VM18671:1 Warning: div: ref is not a prop. Trying to access it will result in undefined being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)

The expected behavior

No Error

@SaintPepsi SaintPepsi added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Jul 17, 2024
@eps1lon
Copy link
Collaborator

eps1lon commented Jul 22, 2024

Do you have multiple versions of React installed?

@SaintPepsi
Copy link
Author

@eps1lon No, however we did notice that this only happens when adding console logs strangely enough, It might have something to do with vite actually 🤔

@sqndr

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

3 participants