Children props
FabrixComponent
provides useful functions and data through its children prop. Once children prop is given to FabrixComponent
, the React node returned from children completely overrides how the component is rendered.
This feature is expected to be used to decorate the component or modify styles of it in an ad-hoc way. For more precise control like in-component styling, callback and behaviour, you can use the custom component builder.
Anatomy
The terminalogies used in functions that children prop provides are coming from as follows:
getComponent
getComponent
is a function that renders a component associated to the operation and the included selection.
Fabrix renders components based on the selection in a GraphQL operation, so this function is the minimum unit to render a component.
getOperation
getOperation
is a function that renders a component associated to the operation name.
Fabrix supports multiple operations in query
prop, so with this function users would be able to render components selectively.
Plus, getOperation
has a render prop in the second argument that gives us getComponent
as well.
data
data
is a raw value that is simply passed down from the fetched result.