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,
- Logic in
class-model.phpto use WordPress data. - Mock data in
__mocks__/data.jsto 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.