rerender()

The global rerender() utility is how you tell Cuek that something has changed and the UI needs to catch up. It is the manual override for state updates.

Usage

You can target specific components or groups of components.

import { rerender } from "cuekjs";
import MyComponent from "./MyComponent";

// Option 1: Rerender every instance of a specific component type
rerender(MyComponent);

// Option 2: Rerender all components registered in a group
rerender("my-group-id");

Parameters

  • target: Can be a component function or a string ID. If it is a string, it maps to the group prop passed to component instances.

When to use it

Local updates usually happen via ctx.rerender(). Use the global rerender() utility when:

  1. Global state changed: You updated a variable outside of any component and need the UI to reflect it.
  2. Cross-component communication: You need one component to trigger an update in another without passing props through a parent.

It is explicit and fast. If you tell Cuek to rerender, it rerenders. If you do not, it stays quiet.