Can a custom block persist it’s data as state? (not as html)

[ad_1]

I made a custom Gurtenberg (React) component where an admin can select a “tier”. The problem is that the tier is lost as soon as the admin exits the edit page.

I know you can save data as <div>{attribute.some\_value}</div>, but I need the tier saved as a number so when I make the API call I have that. Is this possible? Should I switch to PHP?

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer