Skip to content

Use Ref Over ID #157

@amcdnl

Description

@amcdnl

The better way would be to use a Ref here rather than a id selector.

https://github.com/okta/samples-js-react/blob/master/custom-login/src/Login.jsx#L47

Should be:

    const divRef = useRef<HTMLDivElement | null>(null);

    widget.renderEl(
        {
          el: divRef.current
        }
        // etc
    );


<div ref={divRef} />

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