Mojang / ore-ui

💎 Building blocks to construct game UIs using web tech.

Home Page:https://react-facet.mojang.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: return a ref from useFacetState

xaviervia opened this issue · comments

Example:

const [valueFacet, setValue, valueRef] = useFacetState(0)

This would be equivalent to doing

const [valueFacet, setValue] = useFacetState(0)
const valueRef = useFacetRef(valueFacet)

But then there would be no need for useFacetRef do use a useFacetEffect, instead updating the ref could happen in the setter. This would help with performance, and make the type of the ref cleaner (since it can't be NO_VALUE in this case)