Use useBitfieldData(...) when a React component needs data that Runtime Kit has already prepared for that surface.
What this is
useBitfieldData(...) is the public React read hook. It gives a component one consistent return shape:The mental model
The component asks for data by using the hook. Runtime Kit decides what data name that component is allowed to read. The component receives the latest app-facing value.This is not a normal fetch call. The component is not asking a server for a record by URL. It is reading a prepared app value. Runtime Kit may prepare that value from local data, package records, package-owned bytes, derived values, or another public package surface. The component should not import that preparation path.How it works technically
Import
Read the default input
Use the hook without an argument when the surface has one default prepared value.Read a named input
Use a string selector when the surface exposes more than one data name.Read with local params
Some surfaces may allow a selection object with params. Params are local selection data, like the current search query or selected item id.Render every state
Good Runtime Kit components handle four states.Pair it with a request
Use the hook for reading. UsesendRequestToBitfieldTarget(...) when the user asks something to do work.Before / after
Common mistakes
Using the hook as setup codeDo not make the component create package state, storage addresses, or low-level wiring. The component reads prepared app data.Skipping loading and empty statesdata can be null. Treat that as a real state, not an error.Assuming every selector is globalA selector is scoped to the surface that Runtime Kit prepared. If a selector is not available, fix the package/surface boundary instead of hardcoding private reads in the component.Deep importing unpublished Runtime Kit codeOnly import from @bitfield/runtime-kit/react. If code needs private setup machinery, that code is not app component code.