I'm still new to using Redux, but basically I'm creating a javascript scientific calculator for a learning project, and I'm not quite sure if I'm on the right track. basically, the calculator is going to use a stack in the form of an array with parenthetical groupings within an expression being represented as a reference to another element in the stack which contains the expression contained in the parentheses.
for example, 3 * (4 + 1)/5 + ln(6+8)
would be represented by
[
[4, '*', 'ref:1', '/', 5, '+', 'ln', 'ref:2'],
[4, '+', 1],
[6, '+', 8]
]
I'm creating various reducers to handle different pieces. For example, one reducer will handle adding operators to the stack, while another will handle adding numbers to the stack. (after adding their respective elements, each reducer will call two functions that are not a part of the Redux store to handle rendering the input and evaluating/rendering the output into strings, which are also parts of the state object).
Now obviously if the user hits, for example, the number 2, and the last element is the number 3, then the result would be to transform the element into the number 32. However, if the last element is 2, and the user hits the pi key, then I would want to add a '*' operator and THEN 3.14159.
Now it wouldn't make sense for the number reducer to handle adding the '*' operator, and I understand from this question that calling dispatch from the reducer is considered to be an "anti-pattern". Is this where Redux-Thunk would step in, or is there some other solution that I should be looking at?
Also, I was reading this article and I'm not quite sure what they mean when they say that two reducers can't share state slices. What exactly is a single slice, and how is one slice differentiated from another within the combineReducers function?