Development
In the reducer handle the following actions
BLOCK_ADD //block is added
BLOCK_REMOVE //block is removed
BLOCK_WORD_REMOVE //word in a block is removed
the blocks reducer will contain two reducers
And the store should look like this
const store = {
...
blocks: {
byId: {
'block1': {
id: 'block1',
words: ['1', '2']
},
'block2': {
id: 'block2',
words: ['3', '4']
}
},
allIds: ['block1', 'block2']
}
};
Development
In the reducer handle the following actions
the
blocksreducer will contain two reducersbyIdallIdsAnd the store should look like this