Rather than passing handleChange
directly to onChange
, you can use an anonymous function to call it:
<CheckboxControl
key={index}
checked={isChecked}
label={element.title}
help={element.description}
name={element.name}
onChange={(value) => {
handleChange(element.name, value);
}}
/>
Then your handleChange
function can accept the name and value as its parameters.
const handleChange = (name, value) => {
setInputs(values => ({...values, [name]: value}));
};
Related Posts:
- Add pre-publish conditions to the block editor
- How does Gutenberg handle translations in React?
- How can I access core/paragraph textColor in a block template
- Saving post meta using the new EntityProvider APIs
- Implement Panel Color Inspector Control in Gutenberg
- gutenberg dynamic block is returning 404
- Gutenberg InspectorControls is deprecated, how to add custom block settings?
- How should you internationalize javascript spread in multiple files but build in one?
- Why is onChange={ ( content ) => setAttributes( { content } )} now used?
- How to set column widths in a CPT block template?
- Access GutenBerg data with Javascript?
- Gutenberg: How to Change Post Status Programmatically?
- Adding a custom PanelColorSettings control to a core block, and using the color slug in a custom className
- Enhancing Gutenberg featured image control
- Is it possible to create column width presets in Gutenberg?
- How to define a Block Style in an Innerblocks template
- Option for removing block not appearing in custom gutenberg block
- Testing custom themes / plugins under Gutenberg
- Gutenberg LinkControl suggestionsQuery not working
- Gutenberg – How to prevent block from being deleted and reordered/moved
- WordPress Gutenberg Columns block
- Gutenberg InnerBlocks predefined block supports
- Is it possible to bulk migrate all deprecated instances of a gutenberg block?
- How to Add a Container Class to Standard Gutenberg Blocks
- How to display InnerBlocks in render callback
- How to check if post has Video or Gallery block in Gutenberg blocks?
- Gutenberg – button to parse and format all blocks?
- Custom WP Block using Inner Blocks crashes editor, doesn’t save content
- Gutenberg Button Border Radius Default
- Disable title block on edit screen for a custom post type
- Gutenberg: Block validation fails if editor is reloaded or post is edited. data.getBlocks(); is empty in save function
- Delete a Gutenberg Block Programmatically?
- Can Gutenberg be used as an editor on a page?
- Import external data into post using custom Gutenberg block
- How do a I add an attribute to element (when using block theme)?
- How to transform block variant to default version?
- How can I add a color picker to a custom Gutenberg block which includes the default system palette from theme.json?
- How to makes Custom Post Type posts as Gutenberg’s patterns?
- Can’t run WP e2e-test-utils because the browser exits on login?
- Modify the InnerBlocks ‘Add block’ block appender label
- wp_schedule_single_event issue with save_post hook in gutenberg
- Gutenberg TextareaControl escapes html
- Block editor fails to update HTML section when the word “from” is in source code
- Gutenberg extending the existing class
- Creating Block templates with ‘core/heading’ other than level 2
- how to trigger a Gutenberg image gallery lightbox
- Remove or rename “Default” from Gutenberg typography settings
- How to put and components inside in Gutenberg block
- Wp-script package stop to work
- CheckboxControl does not visible change
- How to import Reusable Blocks programatically?
- Remove formatting in rich text with Gutenbergs Block editor
- Setting font sizes in theme.json
- Is it possible to disable font sizes on sub blocks only?
- Get selected block every time a new block is selected in Gutenberg
- How do I include and iframe in a Custom Block?
- Gutenberg InnerBlocks with ACF Blocks – How to enable multiple buttons?
- How to work with multilingual sites using the full site editor and block themes?
- Trying to edit a page returns the editor encountered an unexpected error
- Block patterns: Any way to reset the pattern to whatever is in the code?
- Block variation / Variation API scope “transform”
- Is there a function to “blockify” html?
- Custom style css doesn’t work in Gutenberg preview
- Gutenberg get list of all custom image sizes
- How to set a template part area?
- Video Block does not autoplay
- Upgraded to wordpress 5.7 and now I can’t select myself as a post author
- Stop JSON code from injecting into gutenburg classic block
- Extend the “Convert to Blocks” feature to add additional functionality
- Blocks. How to store default settings?
- Gutenberg/WordPress – Limit number of categories
- Block editor not displaying properly
- Can the Gutenberg editor be toggled closed?
- Guenberg Block Not Saving – When additional div added
- How to open WordPress media create/edit Gallery Dialog
- Pages are editable in Gutenberg, but posts are coming up in classic editor
- WordPress custom block compatability with WPML
- Add a button to the Gutenberg editor header
- Component toggle not toggling
- Disabling gutenbeg slow down post saving
- How to solve react dom ‘removeChild’ on Node error while google translate extension is on and selecting any core block [closed]
- WordPress “HTML editor” which doesn’t trash hand-coded HTML?
- How to force package.json to create build some files?
- How to modify array of object in Gutenberg (block/editor)?
- fetch more than 100 records in block editor API call
- How can I deprecate an old version of my custom Gutenberg block, but keep the new version?
- register_block_type – no block available in block editor
- Block development: how to bump version on generated css files?
- Full Site Editing (FSE) – How do I display no results with wp:query?
- Categories, tags and thumbnails panels are not visible in the Block editor’s post menu
- How to translate multiple blocks within one plugin
- How to disable the Code Editor in Gutenberg?
- Enable Gutenberg Editor when editing tags
- How to position more than one item over an image in a Gutenberg WordPress block theme
- Some CSS classes missing when rendering the page with get_the_content()
- Error with RichText Component
- Rem font size is different in the frontend and block editor
- Add to Media Inserter Categories
- Get attributes from last block created
- How do I make the block editor use https by default?