Skip to content

Styling

Unistyles 3 with the React Compiler on. For styles that depend on props or state, use a dynamic function (field: (state: FieldState) => ({ … }), used as style={styles.field(state)}), not variants + styles.useVariants(). The compiler memoizes style={[styles.x, …]} without knowing that useVariants changed styles.x, so the old variant stays on screen (a focus border that never clears, a stale selected tab). A dynamic function’s arguments are ordinary dependencies, so it stays correct and memoized. ESLint rejects useVariants. Theme switches don’t re-render either way: Unistyles updates native views directly.