---
title: "Engineering standards"
description: "Each edbn/ui component follows 20 rules for server rendering, hydration, concurrent rendering, portals, effects, and accessibility."
docs: https://ui.edbn.me/docs/standards
---

# Standards

Each edbn/ui component follows these 20 rules. They make sure that components work with server rendering, hydration, concurrent rendering, portals, keyboards, and screen readers.

| # | Area | Rule |
| --- | --- | --- |
| 01 | Server rendering | Use window, document, and localStorage only in effects. |
| 02 | Hydration | The first client render must match the server HTML. |
| 03 | Unique IDs | Use useId for IDs that connect elements, for example a label and its input. |
| 04 | Concurrent rendering | Do not cause side effects during render. |
| 05 | Composition | Do not use cloneElement or Children.map. |
| 06 | Portals and iframes | Attach global listeners to ownerDocument.defaultView, not to window. |
| 07 | Transitions | Put state updates from user actions in startTransition. |
| 08 | Activity | Remove DOM changes in a useLayoutEffect cleanup, or use CSS media queries. |
| 09 | Memory leaks | Each effect stops what it starts, in its cleanup function. |
| 10 | Memoization | Use useMemo only to make code faster. Keep values that must not change in state. |
| 11 | Race conditions | Effects that fetch data ignore old responses, with an ignore flag or an AbortController. |
| 12 | Derived state | Calculate values during render. Do not set state from a chain of effects. |
| 13 | Context | A context hook throws an error when a component uses it outside its provider. |
| 14 | External data | Read browser and third-party data with useSyncExternalStore. |
| 15 | Strict Mode | The component works correctly when Strict Mode mounts it two times. |
| 16 | State reset | Change the key to reset state. Do not use an effect. |
| 17 | Accessibility | All controls work with a keyboard. ARIA attributes are correct. Focus goes to the correct element. |
| 18 | Imports | Import each component from its own file, not from an index file. |
| 19 | Theming | Set CSS variables on each component instance, not globally. |
| 20 | Events and effects | Put the code for a user action in its event handler, not in an effect. |
