Skip to content
This repository was archived by the owner on Nov 14, 2020. It is now read-only.
This repository was archived by the owner on Nov 14, 2020. It is now read-only.

makeLocalizedElement assumes stateless component is desired #13

@danehammer

Description

@danehammer

I'm not sure how we could avoid this, and I've already patched my code to put the state a layer higher than the component definition, but thought I would share.

I have a customized TextInput that saves off a ref of the input on the instance. Renders something like:

<input
  ref='input'
  label='a string i need translated'
  ... />

And when that custom component is used with makeLocalizedElement:

const LocTextInput = makeLocalizedElement(TextInput, {label: true})

// ...

<LocTextInput
  ref='username'
  label='Username'/>

I get warned by React that I can't have a ref on the stateless functional component (the Loc returned by makeLocalizedElement)

Could we add something to makeLocalizedElement, maybe a flag, that it would branch on and instead create a stateful component?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions