Creating a UI Field to display chart data #1723
-
I'm trying to create a My Group Field looks something like this... const MyChartField: GroupField = {
name: 'my-chart-field',
type: 'group',
required: true,
fields: [
{
name: 'Preview',
type: 'ui',
admin: {
components: {
Cell: (args) => {
console.log('cell', args)
return <div>Cell</div>
},
Field: (args) => {
// Uncommenting the following hooks causes infinite re-renders
// Get the `x` field state.
// const x = useFormFields(
// ([fields, dispatch]) => fields['my-chart-field.x']
// )
// Get the `y` field state.
// const y = useFormFields(
// ([fields, dispatch]) => fields['my-chart-field.y']
// )
console.log('field', args)
return <div>Field</div>
},
},
},
},
Slider({ name: 'x' }),
Slider({ name: 'y' }),
],
} My issue is that whenever I try to access sibling data from within the Thanks in advance! UPDATE: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey @asibilia can you throw this into another file and then import that component here? I am unsure about using react right in the config file itself. Let me know if you get around to giving that a shot! |
Beta Was this translation helpful? Give feedback.
Hey @asibilia can you throw this into another file and then import that component here? I am unsure about using react right in the config file itself. Let me know if you get around to giving that a shot!