Mock Data

Environment Data from WordPress or Mocks

This section will cover how to populate your components with WordPress and/or mock data.

Overview

Components that require data/hydration to come from WordPress need two things,

  1. Logic in class-model.php to use WordPress data.
  2. Mock data in __mocks__/data.js to use in the style guide.
✏️

Using mock values in the component defaults can result in mock data overriding WordPress data. For example, the text prop for a <Text /> component shouldn't have a default value, only mock data.