Skip to content

How Should Refs Work? #3234

Closed
Closed
@sebmarkbage

Description

@sebmarkbage

Spinoff discussion of #1373, #3128 and #3228.

We're pretty sure that we need to change the current way refs work (see above). However, the new ref callbacks are also not ideal because it relies on some imperative code and suffers from timing issues like all imperative life-cycles. It is also not very convenient without arrow functions. Even with arrow functions it might suffer from performance issues.

A few things refs tries to solve:

  • Imperative access to APIs that doesn't have declarative counter-parts yet. E.g. DOM layout.
  • Fast-path down the tree to update deeply to by-pass reconciliation. Perf-optimization.
  • Get the current state of a child that you don't want to control without duplicating state (which might possibly diverge).
  • Send signals/pulses downwards.

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