How to TDD with BDD-Gherkin 3: Adding React-Redux handling
The continuation step-by-step tutorial, in which we see how to transform an application gradually to consume from a shared state.
The two lasts stories have been:
In which, step by step, we have created a component using TDD to create a component, and make it consume data from an external services.
Now we will continue one step further, we will refactor it to add a React-Redux state. This way is one of the several possible approaches to have the same result, but there are more. In this case, we want to show how to go by small steps, but at the same, that it is also possible to refactor existing components without application wide state.
In this case, I will focus on redux-toolkit because
the createStore
from redux is officially deprecated. But if you are looking how to do it with classic Redux, you can look at my previous story: The Fastest way to Learn Redux. Although this time, we will be using a different approach.
Like in the two previous stories, we will be working with the same feature file, which is the following:
# /features/ShopList.feature
Feature: Shop List
Scenario: List products with no products
When I list products
Then there should be 0 products…