Skip to content

How to refer to an element? Missing docs? #77

Open
@Hi-Angel

Description

@Hi-Angel

Was first brought up on the discourse forum.

It's often useful to refer to one DOM element from another. So for example you may have a modal window Component/JSX, and you have a button that would call showModal on it. So you want the button to refer to the window.

That's provided by both Halogen and the original React.

Now, React Hooks presumably provides something similar… This is hinted by the existence of ref field in each JSX, and by useRef presence. But whether and how it works is completely unknown.

The useRef returns a data UseRef and Ref, but the former is an opaque data with zero functions for it, and the latter is just a container for an arbitrary value you'd pass over to the call. So I've no idea what it could be used for.

Similarly, the ref fields are supposed to contain some Node, but again that requires for a function JSX -> Node to exist, which it doesn't.

So what's the status of this feature, and what these ref and useRef are for anyway?

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