• Hi,

    I’m trying to store a variable in attributes when a user clicks in a button but don’t store it.

    
    <Button key={attributes.sample}
           value={attributes.sample}
           className={<code>${className}__button</code>}
           onChange={sample => setAttributes({sample})}
           onClick={() => setAttributes({sample: 'hi'})}
          >
         Sample
    </Button>
    

    Variables was stored in client inside when interact with the page but never when the user clicks “Save Post Button”

    Any clue? Any advance information how attributes works (I think i’m a little confused)?

The topic ‘Set/Store Attribute with Button (Gutenberg)’ is closed to new replies.