Skip to content

Bug: div: ref is not a prop #30367

@SaintPepsi

Description

@SaintPepsi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions