Ollie Block Academy

Storing Data with Blocks

Storing attributes in the Database

The save function receives props containing all block attributes and returns the HTML markup that gets stored in the database. Use object destructuring to extract the attributes property for clean code.

For rich text content, use the RichText.Content component rather than raw attribute values. This component properly handles the rich text format and ensures correct HTML output in the database.

The save function runs whenever content is saved, converting the current attribute values into the HTML markup that will be stored and displayed on the frontend.

Back to: Ollie Block Academy > Storing Data with Blocks