every changes will break the application we have to do our best not to revise the interface
each component should be ElementComponent
so that it can be converted to Craft Element.
To convert to Craft element, simply use:
Craftize(ElementComponent)
for an element component, you will get the following props:
- className: after crafting, you will get the styled className
- loading: you will get partial props for loading
- errors: you will get partial props for errors
- editing: craft editor state
- other props you set
when the state changed into loading, the data/error state should still exist. also, when the state changed into error, the original UI should be kept.
- Custom hook: not suitable for development
- useState: not suitable for graphql
- Conditional render: not suitable for flexible UI component we focus on data processing instead of passing through annoying arguments