Skip to content

React.Fragment causes errors in the console #261

Closed
@oddsund

Description

@oddsund

I'm submitting a ...

[X ] bug report
[ ] feature request
[ ] support request

If you're reporting a bug, please provide a minimal demonstration of the problem

https://codesandbox.io/s/ll886vz80l

What is the current behavior?

An error stating "TypeError: _this.content is undefined" is printed on each scroll event when returning React.Fragment from the render callback function.

What is the expected or desired behavior?

No error.

Why do you want this? What use case do you have?

A Sticky element containing several elements.

What is your environment?

  • Version: 6.0.3
  • Browser: Firefox 63
  • React: 16.6

Is there anything else I should know?

The error seems to come from src/Sticky.js#L125. findDOMNode seems to return undefined when called with the context of a react fragment, even though it should return the ref to the first child.

While it might not make sense to use Fragments as a child of a Sticky node, some documentation mentioning it would be greatly appreciated. :)

Also, as a heads up, findDOMNode is on its way to deprecation(according to facebook/react#13841, solution here: https://reactjs.org/docs/strict-mode.html#warning-about-deprecated-finddomnode-usage)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions