Skip to content

ref error when wrapping stateless functional component #30

Open
@atomanyih

Description

@atomanyih

If you use Dimensions to wrap a stateless functional component it complains but still seems to work.

const SomebodyCaresAboutDimensions = ({containerWidth} => (
  <div>
    width: {containerWidth}
  </div>
));

export default Dimensions()(SomebodyCaresAboutDimensions);

will give

Warning: Stateless function components cannot be given refs (See ref "wrappedInstance" in SomebodyCaresAboutDimensions created by DimensionsHOC). Attempts to access this ref will fail.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions