Hooks
State and effects for your components, plus the few that reach outside them.
State
useState— component stateuseReducer— state through a reduceruseContext— read a context valueuseObservable— read an observable
Effects and lifecycle
References
useRef— a mutable value that survives re-renders
Minecraft
usePlayer— the player looking at this screenuseEvent— subscribe to a Minecraft event signal for as long as the screen is mounted
Hosts
useMechanism— what this kind of component becomes on the screen it is drawn on
Localization
useTranslation— bind an addon's typed translation verbs to the viewing playeruseTranslationResolver— read the resolver active for this part of the treeuseComposed— compose a string in every language the pack ships, at the width the layout gives a box
Where the state lives
A form cannot be mutated while open, so a state change never repaints what the player is looking at — they see a new snapshot when they press. A container screen's state belongs to its entity or block and outlives every viewer. Both are covered in State.
usePlayer() has no answer on a container screen: one compiled layout serves everyone, so the screen learns who is looking from <Container onOpen> instead.
Next steps
- State — the model behind all of these
- Components — what the hooks drive
- API —
render(), contexts and the compiled-screen registry