Mocking data

The dispatcher in Flux architectures is the single point of entry for new data entering the system. This makes it easy to fabricate mock data to help us churn out features faster. In this section, we'll discuss mocking existing APIs, and whether or not this is worthwhile to build into the action creator functions that talk to them. Then, we'll go over implementing mocks for new APIs that doesn't yet exist, followed by a look at strategies to substitute mock action creators for the real deal.

Mocking existing APIs

In order to mock data in a Flux system, the actions that are dispatched need to deliver this mock data to the stores. This is done by creating an alternative implementation of the action creator function that dispatches the ...

Get Flux Architecture now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.