Create new
Bindings
Transitions
Animations
Easing
Component composition
Context API
Special elements
Module context
Debugging
Miscellaneous
App.svelte
runes
This component is not in runes mode.
To enable runes mode, either start using runes in your code, or add the following to the top of your component:
<svelte:options runes />
999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
⌄
⌄
⌄
⌄
⌄
⌄
<script>
import { createStore } from 'redux'; // Import the redux package
const initialState = {
counter: 0,
posts: [], // Initial state for storing fetched posts
};
// Reducer function to handle state updates
function reducer(state = initialState, action) {
switch (action.type) {
case 'INCREMENT_COUNTER':
return { ...state, counter: state.counter + 1 }; // Increment the counter value in the state
case 'DECREMENT_COUNTER':
return { ...state, counter: state.counter - 1 }; // Decrement the counter value in the state
case 'INCREMENT_COUNTER_BY_AMOUNT':
return { ...state, counter: state.counter + action.payload }; // Increment the counter value in the state by some amount
case 'DECREMENT_COUNTER_BY_AMOUNT':
return { ...state, counter: state.counter - action.payload }; // Decrement the counter value in the state by some amount
case 'RESET_COUNTER':
return { ...state, counter: 0 }; // Reset the counter value in the state to 0
case 'FETCH_POSTS_SUCCESS':
return { ...state, posts: action.payload }; // Update the posts array in the state with the fetched data
case 'RESET_POSTS':
return { ...state, posts: [] }; // Reset posts array
default:
return state; // Return the current state if the action is not recognized
}
}
// Store enhancer function to enhance the store capabilities
function storeEnhancer(createStoreApi) {
return function (reducer, initialState) {
const reduxStore = createStoreApi(reducer, initialState);
return {
...reduxStore,
999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
⌄
⌄
⌄
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';
import { createStore } from 'redux'; // Import the redux package
var root_1 = $.template(`<p>Posts empty</p>`);
var root_3 = $.template(`<li> </li>`);
var root_2 = $.template(`<ul></ul>`);
var root = $.template(
`<h1>Counter Demo with Redux and Svelte</h1> <button>-</button> <button>+</button> <br> <input type="text" placeholder="amount"> <button> </button> <button> </button> <br> <button>Reset</button> <button>Reset Amount</button> <br><br> <button>Fetch Posts (by calling API)</button> <button>Reset Posts Data</button> <h2>Posts</h2> <!> <h2>Notes</h2> <pre>All code is in a single file and it's intended like that for learning purposes.<br>Later, you can refactor it into separate module files for better organization.</pre> <pre>What you learn here is:
- Using Redux with Svelte (traditional Redux).
- Multiple reducer types that use payloads or not.
- Reactive binding with a variable attached to input value.
- Fetching data from an API and storing it in Redux state.
--
Best regards,
Sony AK
https://github.com/sonyarianto</pre>`,
1
);
export default function App($$anchor, $$props) {
$.push($$props, false);
const [$$stores, $$cleanup] = $.setup_stores();
const $store = () => $.store_get(store, '$store', $$stores);
const initialState = {
counter: 0,
posts: [] // Initial state for storing fetched posts
};
// Reducer function to handle state updates
function reducer(state = initialState, action) {
switch (action.type) {
result = svelte.compile(source, {
generate: ,
});9
1
›
/* Add a <style> tag to see the CSS output */
Root {
- css: null
- js: []
- start: 3654
- end: 5099
- type: "Root"
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (41)
Text {...}
- type: "Text"
- start: 3652
- end: 3654
- raw: "\n\n"
- data: "\n\n"
} RegularElement {...}
- type: "RegularElement"
- start: 3654
- end: 3697
- name: "h1"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 3658
- end: 3692
- raw: "Counter Demo with Redux and Svelte"
- data: "Counter Demo with Redux and Svelte"
}
]
}
} Text {...}
- type: "Text"
- start: 3697
- end: 3698
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 3698
- end: 3744
- name: "button"
attributes: [...] (1)
OnDirective {...}
- start: 3706
- end: 3733
- type: "OnDirective"
- name: "click"
expression: Identifier {...}
- type: "Identifier"
- start: 3716
- end: 3732
loc: {...}
start: {...}
- line: 104
- column: 18
}end: {...}
- line: 104
- column: 34
}
}- name: "counterDecrement"
}- modifiers: []
}
]fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 3734
- end: 3735
- raw: "-"
- data: "-"
}
]
}
} Text {...}
- type: "Text"
- start: 3744
- end: 3745
- raw: " "
- data: " "
} ExpressionTag {...}
- type: "ExpressionTag"
- start: 3745
- end: 3761
expression: MemberExpression {...}
- type: "MemberExpression"
- start: 3746
- end: 3760
loc: {...}
start: {...}
- line: 105
- column: 1
}end: {...}
- line: 105
- column: 15
}
}object: Identifier {...}
- type: "Identifier"
- start: 3746
- end: 3752
loc: {...}
start: {...}
- line: 105
- column: 1
}end: {...}
- line: 105
- column: 7
}
}- name: "$store"
}property: Identifier {...}
- type: "Identifier"
- start: 3753
- end: 3760
loc: {...}
start: {...}
- line: 105
- column: 8
}end: {...}
- line: 105
- column: 15
}
}- name: "counter"
}- computed: false
- optional: false
}
} Text {...}
- type: "Text"
- start: 3761
- end: 3762
- raw: " "
- data: " "
} Comment {...}
- type: "Comment"
- start: 3762
- end: 3811
- data: " Display the counter value from the store "
} Text {...}
- type: "Text"
- start: 3811
- end: 3812
- raw: ""
- data: ""
} RegularElement {...}
- type: "RegularElement"
- start: 3812
- end: 3858
- name: "button"
attributes: [...] (1)
OnDirective {...}
- start: 3820
- end: 3847
- type: "OnDirective"
- name: "click"
expression: Identifier {...}
- type: "Identifier"
- start: 3830
- end: 3846
loc: {...}
start: {...}
- line: 106
- column: 18
}end: {...}
- line: 106
- column: 34
}
}- name: "counterIncrement"
}- modifiers: []
}
]fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 3848
- end: 3849
- raw: "+"
- data: "+"
}
]
}
} Text {...}
- type: "Text"
- start: 3858
- end: 3860
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 3860
- end: 3866
- name: "br"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
- nodes: []
}
} Text {...}
- type: "Text"
- start: 3866
- end: 3867
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 3867
- end: 3957
- name: "input"
attributes: [...] (4)
Attribute {...}
- type: "Attribute"
- start: 3874
- end: 3885
- name: "type"
value: [...] (1)
Text {...}
- start: 3880
- end: 3884
- type: "Text"
- raw: "text"
- data: "text"
}
]
} Attribute {...}
- type: "Attribute"
- start: 3886
- end: 3906
- name: "placeholder"
value: [...] (1)
Text {...}
- start: 3899
- end: 3905
- type: "Text"
- raw: "amount"
- data: "amount"
}
]
} BindDirective {...}
- start: 3907
- end: 3931
- type: "BindDirective"
- name: "value"
expression: Identifier {...}
- type: "Identifier"
- start: 3919
- end: 3930
loc: {...}
start: {...}
- line: 109
- column: 52
}end: {...}
- line: 109
- column: 63
}
}- name: "amountValue"
}- modifiers: []
} OnDirective {...}
- start: 3932
- end: 3954
- type: "OnDirective"
- name: "input"
expression: Identifier {...}
- type: "Identifier"
- start: 3942
- end: 3953
loc: {...}
start: {...}
- line: 109
- column: 75
}end: {...}
- line: 109
- column: 86
}
}- name: "handleInput"
}- modifiers: []
}
]fragment: Fragment {...}
- type: "Fragment"
- nodes: []
}
} Text {...}
- type: "Text"
- start: 3957
- end: 3959
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 3959
- end: 4061
- name: "button"
attributes: [...] (1)
OnDirective {...}
- start: 3967
- end: 4021
- type: "OnDirective"
- name: "click"
expression: ArrowFunctionExpression {...}
- type: "ArrowFunctionExpression"
- start: 3977
- end: 4020
loc: {...}
start: {...}
- line: 111
- column: 18
}end: {...}
- line: 111
- column: 61
}
}- id: null
- expression: true
- generator: false
- async: false
- params: []
body: CallExpression {...}
- type: "CallExpression"
- start: 3983
- end: 4020
loc: {...}
start: {...}
- line: 111
- column: 24
}end: {...}
- line: 111
- column: 61
}
}callee: Identifier {...}
- type: "Identifier"
- start: 3983
- end: 4007
loc: {...}
start: {...}
- line: 111
- column: 24
}end: {...}
- line: 111
- column: 48
}
}- name: "counterIncrementByAmount"
}arguments: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 4008
- end: 4019
loc: {...}
start: {...}
- line: 111
- column: 49
}end: {...}
- line: 111
- column: 60
}
}- name: "amountValue"
}
]- optional: false
}
}- modifiers: []
}
]fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (3)
Text {...}
- type: "Text"
- start: 4022
- end: 4038
- raw: "Increment by "
- data: "Increment by "
} ExpressionTag {...}
- type: "ExpressionTag"
- start: 4038
- end: 4051
expression: Identifier {...}
- type: "Identifier"
- start: 4039
- end: 4050
loc: {...}
start: {...}
- line: 112
- column: 16
}end: {...}
- line: 112
- column: 27
}
}- name: "amountValue"
}
} Text {...}
- type: "Text"
- start: 4051
- end: 4052
- raw: "\n"
- data: "\n"
}
]
}
} Text {...}
- type: "Text"
- start: 4061
- end: 4062
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4062
- end: 4164
- name: "button"
attributes: [...] (1)
OnDirective {...}
- start: 4070
- end: 4124
- type: "OnDirective"
- name: "click"
expression: ArrowFunctionExpression {...}
- type: "ArrowFunctionExpression"
- start: 4080
- end: 4123
loc: {...}
start: {...}
- line: 114
- column: 18
}end: {...}
- line: 114
- column: 61
}
}- id: null
- expression: true
- generator: false
- async: false
- params: []
body: CallExpression {...}
- type: "CallExpression"
- start: 4086
- end: 4123
loc: {...}
start: {...}
- line: 114
- column: 24
}end: {...}
- line: 114
- column: 61
}
}callee: Identifier {...}
- type: "Identifier"
- start: 4086
- end: 4110
loc: {...}
start: {...}
- line: 114
- column: 24
}end: {...}
- line: 114
- column: 48
}
}- name: "counterDecrementByAmount"
}arguments: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 4111
- end: 4122
loc: {...}
start: {...}
- line: 114
- column: 49
}end: {...}
- line: 114
- column: 60
}
}- name: "amountValue"
}
]- optional: false
}
}- modifiers: []
}
]fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (3)
Text {...}
- type: "Text"
- start: 4125
- end: 4141
- raw: "Decrement by "
- data: "Decrement by "
} ExpressionTag {...}
- type: "ExpressionTag"
- start: 4141
- end: 4154
expression: Identifier {...}
- type: "Identifier"
- start: 4142
- end: 4153
loc: {...}
start: {...}
- line: 115
- column: 16
}end: {...}
- line: 115
- column: 27
}
}- name: "amountValue"
}
} Text {...}
- type: "Text"
- start: 4154
- end: 4155
- raw: "\n"
- data: "\n"
}
]
}
} Text {...}
- type: "Text"
- start: 4164
- end: 4165
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4165
- end: 4171
- name: "br"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
- nodes: []
}
} Text {...}
- type: "Text"
- start: 4171
- end: 4173
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4173
- end: 4223
- name: "button"
attributes: [...] (1)
OnDirective {...}
- start: 4181
- end: 4204
- type: "OnDirective"
- name: "click"
expression: Identifier {...}
- type: "Identifier"
- start: 4191
- end: 4203
loc: {...}
start: {...}
- line: 119
- column: 18
}end: {...}
- line: 119
- column: 30
}
}- name: "counterReset"
}- modifiers: []
}
]fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 4205
- end: 4214
- raw: "Reset"
- data: "Reset"
}
]
}
} Text {...}
- type: "Text"
- start: 4223
- end: 4224
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4224
- end: 4280
- name: "button"
attributes: [...] (1)
OnDirective {...}
- start: 4232
- end: 4254
- type: "OnDirective"
- name: "click"
expression: Identifier {...}
- type: "Identifier"
- start: 4242
- end: 4253
loc: {...}
start: {...}
- line: 122
- column: 18
}end: {...}
- line: 122
- column: 29
}
}- name: "resetAmount"
}- modifiers: []
}
]fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 4255
- end: 4271
- raw: "Reset Amount"
- data: "Reset Amount"
}
]
}
} Text {...}
- type: "Text"
- start: 4280
- end: 4282
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4282
- end: 4288
- name: "br"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
- nodes: []
}
} RegularElement {...}
- type: "RegularElement"
- start: 4288
- end: 4294
- name: "br"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
- nodes: []
}
} Text {...}
- type: "Text"
- start: 4294
- end: 4296
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4296
- end: 4370
- name: "button"
attributes: [...] (1)
OnDirective {...}
- start: 4304
- end: 4332
- type: "OnDirective"
- name: "click"
expression: Identifier {...}
- type: "Identifier"
- start: 4314
- end: 4331
loc: {...}
start: {...}
- line: 128
- column: 18
}end: {...}
- line: 128
- column: 35
}
}- name: "triggerFetchPosts"
}- modifiers: []
}
]fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 4333
- end: 4361
- raw: "Fetch Posts (by calling API)"
- data: "Fetch Posts (by calling API)"
}
]
}
} Text {...}
- type: "Text"
- start: 4370
- end: 4371
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4371
- end: 4426
- name: "button"
attributes: [...] (1)
OnDirective {...}
- start: 4379
- end: 4400
- type: "OnDirective"
- name: "click"
expression: Identifier {...}
- type: "Identifier"
- start: 4389
- end: 4399
loc: {...}
start: {...}
- line: 129
- column: 18
}end: {...}
- line: 129
- column: 28
}
}- name: "resetPosts"
}- modifiers: []
}
]fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 4401
- end: 4417
- raw: "Reset Posts Data"
- data: "Reset Posts Data"
}
]
}
} Text {...}
- type: "Text"
- start: 4426
- end: 4428
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4428
- end: 4442
- name: "h2"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 4432
- end: 4437
- raw: "Posts"
- data: "Posts"
}
]
}
} Text {...}
- type: "Text"
- start: 4442
- end: 4443
- raw: " "
- data: " "
} IfBlock {...}
- type: "IfBlock"
- elseif: false
- start: 4443
- end: 4597
test: BinaryExpression {...}
- type: "BinaryExpression"
- start: 4448
- end: 4473
loc: {...}
start: {...}
- line: 132
- column: 5
}end: {...}
- line: 132
- column: 30
}
}left: MemberExpression {...}
- type: "MemberExpression"
- start: 4448
- end: 4467
loc: {...}
start: {...}
- line: 132
- column: 5
}end: {...}
- line: 132
- column: 24
}
}object: MemberExpression {...}
- type: "MemberExpression"
- start: 4448
- end: 4460
loc: {...}
start: {...}
- line: 132
- column: 5
}end: {...}
- line: 132
- column: 17
}
}object: Identifier {...}
- type: "Identifier"
- start: 4448
- end: 4454
loc: {...}
start: {...}
- line: 132
- column: 5
}end: {...}
- line: 132
- column: 11
}
}- name: "$store"
}property: Identifier {...}
- type: "Identifier"
- start: 4455
- end: 4460
loc: {...}
start: {...}
- line: 132
- column: 12
}end: {...}
- line: 132
- column: 17
}
}- name: "posts"
}- computed: false
- optional: false
}property: Identifier {...}
- type: "Identifier"
- start: 4461
- end: 4467
loc: {...}
start: {...}
- line: 132
- column: 18
}end: {...}
- line: 132
- column: 24
}
}- name: "length"
}- computed: false
- optional: false
}- operator: "==="
right: Literal {...}
- type: "Literal"
- start: 4472
- end: 4473
loc: {...}
start: {...}
- line: 132
- column: 29
}end: {...}
- line: 132
- column: 30
}
}- value: 0
- raw: "0"
}
}consequent: Fragment {...}
- type: "Fragment"
nodes: [...] (3)
Text {...}
- type: "Text"
- start: 4474
- end: 4477
- raw: "\n "
- data: "\n "
} RegularElement {...}
- type: "RegularElement"
- start: 4477
- end: 4495
- name: "p"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 4480
- end: 4491
- raw: "Posts empty"
- data: "Posts empty"
}
]
}
} Text {...}
- type: "Text"
- start: 4495
- end: 4496
- raw: "\n"
- data: "\n"
}
]
}alternate: Fragment {...}
- type: "Fragment"
nodes: [...] (3)
Text {...}
- type: "Text"
- start: 4503
- end: 4506
- raw: "\n "
- data: "\n "
} RegularElement {...}
- type: "RegularElement"
- start: 4506
- end: 4591
- name: "ul"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (3)
Text {...}
- type: "Text"
- start: 4510
- end: 4515
- raw: "\n "
- data: "\n "
} EachBlock {...}
- type: "EachBlock"
- start: 4515
- end: 4583
expression: MemberExpression {...}
- type: "MemberExpression"
- start: 4522
- end: 4534
loc: {...}
start: {...}
- line: 136
- column: 11
}end: {...}
- line: 136
- column: 23
}
}object: Identifier {...}
- type: "Identifier"
- start: 4522
- end: 4528
loc: {...}
start: {...}
- line: 136
- column: 11
}end: {...}
- line: 136
- column: 17
}
}- name: "$store"
}property: Identifier {...}
- type: "Identifier"
- start: 4529
- end: 4534
loc: {...}
start: {...}
- line: 136
- column: 18
}end: {...}
- line: 136
- column: 23
}
}- name: "posts"
}- computed: false
- optional: false
}body: Fragment {...}
- type: "Fragment"
nodes: [...] (3)
Text {...}
- type: "Text"
- start: 4543
- end: 4550
- raw: "\n "
- data: "\n "
} RegularElement {...}
- type: "RegularElement"
- start: 4550
- end: 4571
- name: "li"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
ExpressionTag {...}
- type: "ExpressionTag"
- start: 4554
- end: 4566
expression: MemberExpression {...}
- type: "MemberExpression"
- start: 4555
- end: 4565
loc: {...}
start: {...}
- line: 137
- column: 11
}end: {...}
- line: 137
- column: 21
}
}object: Identifier {...}
- type: "Identifier"
- start: 4555
- end: 4559
loc: {...}
start: {...}
- line: 137
- column: 11
}end: {...}
- line: 137
- column: 15
}
}- name: "post"
}property: Identifier {...}
- type: "Identifier"
- start: 4560
- end: 4565
loc: {...}
start: {...}
- line: 137
- column: 16
}end: {...}
- line: 137
- column: 21
}
}- name: "title"
}- computed: false
- optional: false
}
}
]
}
} Text {...}
- type: "Text"
- start: 4571
- end: 4576
- raw: "\n "
- data: "\n "
}
]
}context: Identifier {...}
- type: "Identifier"
- name: "post"
- start: 4538
loc: {...}
start: {...}
- line: 136
- column: 27
- character: 4538
}end: {...}
- line: 136
- column: 31
- character: 4542
}
}- end: 4542
- typeAnnotation: undefined
}- index: undefined
- key: undefined
} Text {...}
- type: "Text"
- start: 4583
- end: 4586
- raw: "\n "
- data: "\n "
}
]
}
} Text {...}
- type: "Text"
- start: 4591
- end: 4592
- raw: "\n"
- data: "\n"
}
]
}
} Text {...}
- type: "Text"
- start: 4597
- end: 4599
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4599
- end: 4616
- name: "h2"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 4603
- end: 4611
- raw: "Notes"
- data: "Notes"
}
]
}
} Text {...}
- type: "Text"
- start: 4616
- end: 4617
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4617
- end: 4791
- name: "pre"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (3)
Text {...}
- type: "Text"
- start: 4622
- end: 4701
- raw: "All code is in a single file and it's intended like that for learning purposes."
- data: "All code is in a single file and it's intended like that for learning purposes."
} RegularElement {...}
- type: "RegularElement"
- start: 4701
- end: 4707
- name: "br"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
- nodes: []
}
} Text {...}
- type: "Text"
- start: 4707
- end: 4785
- raw: "Later, you can refactor it into separate module files for better organization."
- data: "Later, you can refactor it into separate module files for better organization."
}
]
}
} Text {...}
- type: "Text"
- start: 4791
- end: 4792
- raw: " "
- data: " "
} RegularElement {...}
- type: "RegularElement"
- start: 4792
- end: 5099
- name: "pre"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (1)
Text {...}
- type: "Text"
- start: 4797
- end: 5093
- raw: "What you learn here is:\n- Using Redux with Svelte (traditional Redux).\n- Multiple reducer types that use payloads or not.\n- Reactive binding with a variable attached to input value.\n- Fetching data from an API and storing it in Redux state.\n--\nBest regards,\nSony AK\nhttps://github.com/sonyarianto"
- data: "What you learn here is:\n- Using Redux with Svelte (traditional Redux).\n- Multiple reducer types that use payloads or not.\n- Reactive binding with a variable attached to input value.\n- Fetching data from an API and storing it in Redux state.\n--\nBest regards,\nSony AK\nhttps://github.com/sonyarianto"
}
]
}
}
]
}- options: null
instance: Script {...}
- type: "Script"
- start: 0
- end: 3652
- context: "default"
content: Program {...}
- type: "Program"
- start: 8
- end: 3643
loc: {...}
start: {...}
- line: 1
- column: 0
}end: {...}
- line: 101
- column: 0
}
}body: [...] (16)
ImportDeclaration {...}
- type: "ImportDeclaration"
- start: 11
- end: 47
loc: {...}
start: {...}
- line: 2
- column: 2
}end: {...}
- line: 2
- column: 38
}
}specifiers: [...] (1)
ImportSpecifier {...}
- type: "ImportSpecifier"
- start: 20
- end: 31
loc: {...}
start: {...}
- line: 2
- column: 11
}end: {...}
- line: 2
- column: 22
}
}imported: Identifier {...}
- type: "Identifier"
- start: 20
- end: 31
loc: {...}
start: {...}
- line: 2
- column: 11
}end: {...}
- line: 2
- column: 22
}
}- name: "createStore"
}local: Identifier {...}
- type: "Identifier"
- start: 20
- end: 31
loc: {...}
start: {...}
- line: 2
- column: 11
}end: {...}
- line: 2
- column: 22
}
}- name: "createStore"
}
}
]source: Literal {...}
- type: "Literal"
- start: 39
- end: 46
loc: {...}
start: {...}
- line: 2
- column: 30
}end: {...}
- line: 2
- column: 37
}
}- value: "redux"
- raw: "'redux'"
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Import the redux package"
- start: 48
- end: 75
}
]
} VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 79
- end: 180
loc: {...}
start: {...}
- line: 4
- column: 2
}end: {...}
- line: 7
- column: 4
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 85
- end: 179
loc: {...}
start: {...}
- line: 4
- column: 8
}end: {...}
- line: 7
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 85
- end: 97
loc: {...}
start: {...}
- line: 4
- column: 8
}end: {...}
- line: 4
- column: 20
}
}- name: "initialState"
}init: ObjectExpression {...}
- type: "ObjectExpression"
- start: 100
- end: 179
loc: {...}
start: {...}
- line: 4
- column: 23
}end: {...}
- line: 7
- column: 3
}
}properties: [...] (2)
Property {...}
- type: "Property"
- start: 106
- end: 116
loc: {...}
start: {...}
- line: 5
- column: 4
}end: {...}
- line: 5
- column: 14
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 106
- end: 113
loc: {...}
start: {...}
- line: 5
- column: 4
}end: {...}
- line: 5
- column: 11
}
}- name: "counter"
}value: Literal {...}
- type: "Literal"
- start: 115
- end: 116
loc: {...}
start: {...}
- line: 5
- column: 13
}end: {...}
- line: 5
- column: 14
}
}- value: 0
- raw: "0"
}- kind: "init"
} Property {...}
- type: "Property"
- start: 122
- end: 131
loc: {...}
start: {...}
- line: 6
- column: 4
}end: {...}
- line: 6
- column: 13
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 122
- end: 127
loc: {...}
start: {...}
- line: 6
- column: 4
}end: {...}
- line: 6
- column: 9
}
}- name: "posts"
}value: ArrayExpression {...}
- type: "ArrayExpression"
- start: 129
- end: 131
loc: {...}
start: {...}
- line: 6
- column: 11
}end: {...}
- line: 6
- column: 13
}
}- elements: []
}- kind: "init"
trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Initial state for storing fetched posts"
- start: 133
- end: 175
}
]
}
]
}
}
]- kind: "const"
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 230
- end: 1365
loc: {...}
start: {...}
- line: 10
- column: 2
}end: {...}
- line: 29
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 239
- end: 246
loc: {...}
start: {...}
- line: 10
- column: 11
}end: {...}
- line: 10
- column: 18
}
}- name: "reducer"
}- expression: false
- generator: false
- async: false
params: [...] (2)
AssignmentPattern {...}
- type: "AssignmentPattern"
- start: 247
- end: 267
loc: {...}
start: {...}
- line: 10
- column: 19
}end: {...}
- line: 10
- column: 39
}
}left: Identifier {...}
- type: "Identifier"
- start: 247
- end: 252
loc: {...}
start: {...}
- line: 10
- column: 19
}end: {...}
- line: 10
- column: 24
}
}- name: "state"
}right: Identifier {...}
- type: "Identifier"
- start: 255
- end: 267
loc: {...}
start: {...}
- line: 10
- column: 27
}end: {...}
- line: 10
- column: 39
}
}- name: "initialState"
}
} Identifier {...}
- type: "Identifier"
- start: 269
- end: 275
loc: {...}
start: {...}
- line: 10
- column: 41
}end: {...}
- line: 10
- column: 47
}
}- name: "action"
}
]body: BlockStatement {...}
- type: "BlockStatement"
- start: 277
- end: 1365
loc: {...}
start: {...}
- line: 10
- column: 49
}end: {...}
- line: 29
- column: 3
}
}body: [...] (1)
SwitchStatement {...}
- type: "SwitchStatement"
- start: 283
- end: 1361
loc: {...}
start: {...}
- line: 11
- column: 4
}end: {...}
- line: 28
- column: 5
}
}discriminant: MemberExpression {...}
- type: "MemberExpression"
- start: 291
- end: 302
loc: {...}
start: {...}
- line: 11
- column: 12
}end: {...}
- line: 11
- column: 23
}
}object: Identifier {...}
- type: "Identifier"
- start: 291
- end: 297
loc: {...}
start: {...}
- line: 11
- column: 12
}end: {...}
- line: 11
- column: 18
}
}- name: "action"
}property: Identifier {...}
- type: "Identifier"
- start: 298
- end: 302
loc: {...}
start: {...}
- line: 11
- column: 19
}end: {...}
- line: 11
- column: 23
}
}- name: "type"
}- computed: false
- optional: false
}cases: [...] (8)
SwitchCase {...}
- type: "SwitchCase"
- start: 312
- end: 394
loc: {...}
start: {...}
- line: 12
- column: 6
}end: {...}
- line: 13
- column: 56
}
}consequent: [...] (1)
ReturnStatement {...}
- type: "ReturnStatement"
- start: 346
- end: 394
loc: {...}
start: {...}
- line: 13
- column: 8
}end: {...}
- line: 13
- column: 56
}
}argument: ObjectExpression {...}
- type: "ObjectExpression"
- start: 353
- end: 393
loc: {...}
start: {...}
- line: 13
- column: 15
}end: {...}
- line: 13
- column: 55
}
}properties: [...] (2)
SpreadElement {...}
- type: "SpreadElement"
- start: 355
- end: 363
loc: {...}
start: {...}
- line: 13
- column: 17
}end: {...}
- line: 13
- column: 25
}
}argument: Identifier {...}
- type: "Identifier"
- start: 358
- end: 363
loc: {...}
start: {...}
- line: 13
- column: 20
}end: {...}
- line: 13
- column: 25
}
}- name: "state"
}
} Property {...}
- type: "Property"
- start: 365
- end: 391
loc: {...}
start: {...}
- line: 13
- column: 27
}end: {...}
- line: 13
- column: 53
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 365
- end: 372
loc: {...}
start: {...}
- line: 13
- column: 27
}end: {...}
- line: 13
- column: 34
}
}- name: "counter"
}value: BinaryExpression {...}
- type: "BinaryExpression"
- start: 374
- end: 391
loc: {...}
start: {...}
- line: 13
- column: 36
}end: {...}
- line: 13
- column: 53
}
}left: MemberExpression {...}
- type: "MemberExpression"
- start: 374
- end: 387
loc: {...}
start: {...}
- line: 13
- column: 36
}end: {...}
- line: 13
- column: 49
}
}object: Identifier {...}
- type: "Identifier"
- start: 374
- end: 379
loc: {...}
start: {...}
- line: 13
- column: 36
}end: {...}
- line: 13
- column: 41
}
}- name: "state"
}property: Identifier {...}
- type: "Identifier"
- start: 380
- end: 387
loc: {...}
start: {...}
- line: 13
- column: 42
}end: {...}
- line: 13
- column: 49
}
}- name: "counter"
}- computed: false
- optional: false
}- operator: "+"
right: Literal {...}
- type: "Literal"
- start: 390
- end: 391
loc: {...}
start: {...}
- line: 13
- column: 52
}end: {...}
- line: 13
- column: 53
}
}- value: 1
- raw: "1"
}
}- kind: "init"
}
]
}
}
]test: Literal {...}
- type: "Literal"
- start: 317
- end: 336
loc: {...}
start: {...}
- line: 12
- column: 11
}end: {...}
- line: 12
- column: 30
}
}- value: "INCREMENT_COUNTER"
- raw: "'INCREMENT_COUNTER'"
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Increment the counter value in the state"
- start: 395
- end: 438
}
]
} SwitchCase {...}
- type: "SwitchCase"
- start: 445
- end: 527
loc: {...}
start: {...}
- line: 14
- column: 6
}end: {...}
- line: 15
- column: 56
}
}consequent: [...] (1)
ReturnStatement {...}
- type: "ReturnStatement"
- start: 479
- end: 527
loc: {...}
start: {...}
- line: 15
- column: 8
}end: {...}
- line: 15
- column: 56
}
}argument: ObjectExpression {...}
- type: "ObjectExpression"
- start: 486
- end: 526
loc: {...}
start: {...}
- line: 15
- column: 15
}end: {...}
- line: 15
- column: 55
}
}properties: [...] (2)
SpreadElement {...}
- type: "SpreadElement"
- start: 488
- end: 496
loc: {...}
start: {...}
- line: 15
- column: 17
}end: {...}
- line: 15
- column: 25
}
}argument: Identifier {...}
- type: "Identifier"
- start: 491
- end: 496
loc: {...}
start: {...}
- line: 15
- column: 20
}end: {...}
- line: 15
- column: 25
}
}- name: "state"
}
} Property {...}
- type: "Property"
- start: 498
- end: 524
loc: {...}
start: {...}
- line: 15
- column: 27
}end: {...}
- line: 15
- column: 53
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 498
- end: 505
loc: {...}
start: {...}
- line: 15
- column: 27
}end: {...}
- line: 15
- column: 34
}
}- name: "counter"
}value: BinaryExpression {...}
- type: "BinaryExpression"
- start: 507
- end: 524
loc: {...}
start: {...}
- line: 15
- column: 36
}end: {...}
- line: 15
- column: 53
}
}left: MemberExpression {...}
- type: "MemberExpression"
- start: 507
- end: 520
loc: {...}
start: {...}
- line: 15
- column: 36
}end: {...}
- line: 15
- column: 49
}
}object: Identifier {...}
- type: "Identifier"
- start: 507
- end: 512
loc: {...}
start: {...}
- line: 15
- column: 36
}end: {...}
- line: 15
- column: 41
}
}- name: "state"
}property: Identifier {...}
- type: "Identifier"
- start: 513
- end: 520
loc: {...}
start: {...}
- line: 15
- column: 42
}end: {...}
- line: 15
- column: 49
}
}- name: "counter"
}- computed: false
- optional: false
}- operator: "-"
right: Literal {...}
- type: "Literal"
- start: 523
- end: 524
loc: {...}
start: {...}
- line: 15
- column: 52
}end: {...}
- line: 15
- column: 53
}
}- value: 1
- raw: "1"
}
}- kind: "init"
}
]
}
}
]test: Literal {...}
- type: "Literal"
- start: 450
- end: 469
loc: {...}
start: {...}
- line: 14
- column: 11
}end: {...}
- line: 14
- column: 30
}
}- value: "DECREMENT_COUNTER"
- raw: "'DECREMENT_COUNTER'"
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Decrement the counter value in the state"
- start: 528
- end: 571
}
]
} SwitchCase {...}
- type: "SwitchCase"
- start: 578
- end: 683
loc: {...}
start: {...}
- line: 16
- column: 6
}end: {...}
- line: 17
- column: 69
}
}consequent: [...] (1)
ReturnStatement {...}
- type: "ReturnStatement"
- start: 622
- end: 683
loc: {...}
start: {...}
- line: 17
- column: 8
}end: {...}
- line: 17
- column: 69
}
}argument: ObjectExpression {...}
- type: "ObjectExpression"
- start: 629
- end: 682
loc: {...}
start: {...}
- line: 17
- column: 15
}end: {...}
- line: 17
- column: 68
}
}properties: [...] (2)
SpreadElement {...}
- type: "SpreadElement"
- start: 631
- end: 639
loc: {...}
start: {...}
- line: 17
- column: 17
}end: {...}
- line: 17
- column: 25
}
}argument: Identifier {...}
- type: "Identifier"
- start: 634
- end: 639
loc: {...}
start: {...}
- line: 17
- column: 20
}end: {...}
- line: 17
- column: 25
}
}- name: "state"
}
} Property {...}
- type: "Property"
- start: 641
- end: 680
loc: {...}
start: {...}
- line: 17
- column: 27
}end: {...}
- line: 17
- column: 66
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 641
- end: 648
loc: {...}
start: {...}
- line: 17
- column: 27
}end: {...}
- line: 17
- column: 34
}
}- name: "counter"
}value: BinaryExpression {...}
- type: "BinaryExpression"
- start: 650
- end: 680
loc: {...}
start: {...}
- line: 17
- column: 36
}end: {...}
- line: 17
- column: 66
}
}left: MemberExpression {...}
- type: "MemberExpression"
- start: 650
- end: 663
loc: {...}
start: {...}
- line: 17
- column: 36
}end: {...}
- line: 17
- column: 49
}
}object: Identifier {...}
- type: "Identifier"
- start: 650
- end: 655
loc: {...}
start: {...}
- line: 17
- column: 36
}end: {...}
- line: 17
- column: 41
}
}- name: "state"
}property: Identifier {...}
- type: "Identifier"
- start: 656
- end: 663
loc: {...}
start: {...}
- line: 17
- column: 42
}end: {...}
- line: 17
- column: 49
}
}- name: "counter"
}- computed: false
- optional: false
}- operator: "+"
right: MemberExpression {...}
- type: "MemberExpression"
- start: 666
- end: 680
loc: {...}
start: {...}
- line: 17
- column: 52
}end: {...}
- line: 17
- column: 66
}
}object: Identifier {...}
- type: "Identifier"
- start: 666
- end: 672
loc: {...}
start: {...}
- line: 17
- column: 52
}end: {...}
- line: 17
- column: 58
}
}- name: "action"
}property: Identifier {...}
- type: "Identifier"
- start: 673
- end: 680
loc: {...}
start: {...}
- line: 17
- column: 59
}end: {...}
- line: 17
- column: 66
}
}- name: "payload"
}- computed: false
- optional: false
}
}- kind: "init"
}
]
}
}
]test: Literal {...}
- type: "Literal"
- start: 583
- end: 612
loc: {...}
start: {...}
- line: 16
- column: 11
}end: {...}
- line: 16
- column: 40
}
}- value: "INCREMENT_COUNTER_BY_AMOUNT"
- raw: "'INCREMENT_COUNTER_BY_AMOUNT'"
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Increment the counter value in the state by some amount"
- start: 684
- end: 742
}
]
} SwitchCase {...}
- type: "SwitchCase"
- start: 749
- end: 854
loc: {...}
start: {...}
- line: 18
- column: 6
}end: {...}
- line: 19
- column: 69
}
}consequent: [...] (1)
ReturnStatement {...}
- type: "ReturnStatement"
- start: 793
- end: 854
loc: {...}
start: {...}
- line: 19
- column: 8
}end: {...}
- line: 19
- column: 69
}
}argument: ObjectExpression {...}
- type: "ObjectExpression"
- start: 800
- end: 853
loc: {...}
start: {...}
- line: 19
- column: 15
}end: {...}
- line: 19
- column: 68
}
}properties: [...] (2)
SpreadElement {...}
- type: "SpreadElement"
- start: 802
- end: 810
loc: {...}
start: {...}
- line: 19
- column: 17
}end: {...}
- line: 19
- column: 25
}
}argument: Identifier {...}
- type: "Identifier"
- start: 805
- end: 810
loc: {...}
start: {...}
- line: 19
- column: 20
}end: {...}
- line: 19
- column: 25
}
}- name: "state"
}
} Property {...}
- type: "Property"
- start: 812
- end: 851
loc: {...}
start: {...}
- line: 19
- column: 27
}end: {...}
- line: 19
- column: 66
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 812
- end: 819
loc: {...}
start: {...}
- line: 19
- column: 27
}end: {...}
- line: 19
- column: 34
}
}- name: "counter"
}value: BinaryExpression {...}
- type: "BinaryExpression"
- start: 821
- end: 851
loc: {...}
start: {...}
- line: 19
- column: 36
}end: {...}
- line: 19
- column: 66
}
}left: MemberExpression {...}
- type: "MemberExpression"
- start: 821
- end: 834
loc: {...}
start: {...}
- line: 19
- column: 36
}end: {...}
- line: 19
- column: 49
}
}object: Identifier {...}
- type: "Identifier"
- start: 821
- end: 826
loc: {...}
start: {...}
- line: 19
- column: 36
}end: {...}
- line: 19
- column: 41
}
}- name: "state"
}property: Identifier {...}
- type: "Identifier"
- start: 827
- end: 834
loc: {...}
start: {...}
- line: 19
- column: 42
}end: {...}
- line: 19
- column: 49
}
}- name: "counter"
}- computed: false
- optional: false
}- operator: "-"
right: MemberExpression {...}
- type: "MemberExpression"
- start: 837
- end: 851
loc: {...}
start: {...}
- line: 19
- column: 52
}end: {...}
- line: 19
- column: 66
}
}object: Identifier {...}
- type: "Identifier"
- start: 837
- end: 843
loc: {...}
start: {...}
- line: 19
- column: 52
}end: {...}
- line: 19
- column: 58
}
}- name: "action"
}property: Identifier {...}
- type: "Identifier"
- start: 844
- end: 851
loc: {...}
start: {...}
- line: 19
- column: 59
}end: {...}
- line: 19
- column: 66
}
}- name: "payload"
}- computed: false
- optional: false
}
}- kind: "init"
}
]
}
}
]test: Literal {...}
- type: "Literal"
- start: 754
- end: 783
loc: {...}
start: {...}
- line: 18
- column: 11
}end: {...}
- line: 18
- column: 40
}
}- value: "DECREMENT_COUNTER_BY_AMOUNT"
- raw: "'DECREMENT_COUNTER_BY_AMOUNT'"
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Decrement the counter value in the state by some amount"
- start: 855
- end: 913
}
]
} SwitchCase {...}
- type: "SwitchCase"
- start: 920
- end: 982
loc: {...}
start: {...}
- line: 20
- column: 6
}end: {...}
- line: 21
- column: 40
}
}consequent: [...] (1)
ReturnStatement {...}
- type: "ReturnStatement"
- start: 950
- end: 982
loc: {...}
start: {...}
- line: 21
- column: 8
}end: {...}
- line: 21
- column: 40
}
}argument: ObjectExpression {...}
- type: "ObjectExpression"
- start: 957
- end: 981
loc: {...}
start: {...}
- line: 21
- column: 15
}end: {...}
- line: 21
- column: 39
}
}properties: [...] (2)
SpreadElement {...}
- type: "SpreadElement"
- start: 959
- end: 967
loc: {...}
start: {...}
- line: 21
- column: 17
}end: {...}
- line: 21
- column: 25
}
}argument: Identifier {...}
- type: "Identifier"
- start: 962
- end: 967
loc: {...}
start: {...}
- line: 21
- column: 20
}end: {...}
- line: 21
- column: 25
}
}- name: "state"
}
} Property {...}
- type: "Property"
- start: 969
- end: 979
loc: {...}
start: {...}
- line: 21
- column: 27
}end: {...}
- line: 21
- column: 37
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 969
- end: 976
loc: {...}
start: {...}
- line: 21
- column: 27
}end: {...}
- line: 21
- column: 34
}
}- name: "counter"
}value: Literal {...}
- type: "Literal"
- start: 978
- end: 979
loc: {...}
start: {...}
- line: 21
- column: 36
}end: {...}
- line: 21
- column: 37
}
}- value: 0
- raw: "0"
}- kind: "init"
}
]
}
}
]test: Literal {...}
- type: "Literal"
- start: 925
- end: 940
loc: {...}
start: {...}
- line: 20
- column: 11
}end: {...}
- line: 20
- column: 26
}
}- value: "RESET_COUNTER"
- raw: "'RESET_COUNTER'"
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Reset the counter value in the state to 0"
- start: 983
- end: 1027
}
]
} SwitchCase {...}
- type: "SwitchCase"
- start: 1034
- end: 1113
loc: {...}
start: {...}
- line: 22
- column: 6
}end: {...}
- line: 23
- column: 51
}
}consequent: [...] (1)
ReturnStatement {...}
- type: "ReturnStatement"
- start: 1070
- end: 1113
loc: {...}
start: {...}
- line: 23
- column: 8
}end: {...}
- line: 23
- column: 51
}
}argument: ObjectExpression {...}
- type: "ObjectExpression"
- start: 1077
- end: 1112
loc: {...}
start: {...}
- line: 23
- column: 15
}end: {...}
- line: 23
- column: 50
}
}properties: [...] (2)
SpreadElement {...}
- type: "SpreadElement"
- start: 1079
- end: 1087
loc: {...}
start: {...}
- line: 23
- column: 17
}end: {...}
- line: 23
- column: 25
}
}argument: Identifier {...}
- type: "Identifier"
- start: 1082
- end: 1087
loc: {...}
start: {...}
- line: 23
- column: 20
}end: {...}
- line: 23
- column: 25
}
}- name: "state"
}
} Property {...}
- type: "Property"
- start: 1089
- end: 1110
loc: {...}
start: {...}
- line: 23
- column: 27
}end: {...}
- line: 23
- column: 48
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 1089
- end: 1094
loc: {...}
start: {...}
- line: 23
- column: 27
}end: {...}
- line: 23
- column: 32
}
}- name: "posts"
}value: MemberExpression {...}
- type: "MemberExpression"
- start: 1096
- end: 1110
loc: {...}
start: {...}
- line: 23
- column: 34
}end: {...}
- line: 23
- column: 48
}
}object: Identifier {...}
- type: "Identifier"
- start: 1096
- end: 1102
loc: {...}
start: {...}
- line: 23
- column: 34
}end: {...}
- line: 23
- column: 40
}
}- name: "action"
}property: Identifier {...}
- type: "Identifier"
- start: 1103
- end: 1110
loc: {...}
start: {...}
- line: 23
- column: 41
}end: {...}
- line: 23
- column: 48
}
}- name: "payload"
}- computed: false
- optional: false
}- kind: "init"
}
]
}
}
]test: Literal {...}
- type: "Literal"
- start: 1039
- end: 1060
loc: {...}
start: {...}
- line: 22
- column: 11
}end: {...}
- line: 22
- column: 32
}
}- value: "FETCH_POSTS_SUCCESS"
- raw: "'FETCH_POSTS_SUCCESS'"
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Update the posts array in the state with the fetched data"
- start: 1114
- end: 1174
}
]
} SwitchCase {...}
- type: "SwitchCase"
- start: 1178
- end: 1237
loc: {...}
start: {...}
- line: 24
- column: 3
}end: {...}
- line: 25
- column: 39
}
}consequent: [...] (1)
ReturnStatement {...}
- type: "ReturnStatement"
- start: 1206
- end: 1237
loc: {...}
start: {...}
- line: 25
- column: 8
}end: {...}
- line: 25
- column: 39
}
}argument: ObjectExpression {...}
- type: "ObjectExpression"
- start: 1213
- end: 1236
loc: {...}
start: {...}
- line: 25
- column: 15
}end: {...}
- line: 25
- column: 38
}
}properties: [...] (2)
SpreadElement {...}
- type: "SpreadElement"
- start: 1215
- end: 1223
loc: {...}
start: {...}
- line: 25
- column: 17
}end: {...}
- line: 25
- column: 25
}
}argument: Identifier {...}
- type: "Identifier"
- start: 1218
- end: 1223
loc: {...}
start: {...}
- line: 25
- column: 20
}end: {...}
- line: 25
- column: 25
}
}- name: "state"
}
} Property {...}
- type: "Property"
- start: 1225
- end: 1234
loc: {...}
start: {...}
- line: 25
- column: 27
}end: {...}
- line: 25
- column: 36
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 1225
- end: 1230
loc: {...}
start: {...}
- line: 25
- column: 27
}end: {...}
- line: 25
- column: 32
}
}- name: "posts"
}value: ArrayExpression {...}
- type: "ArrayExpression"
- start: 1232
- end: 1234
loc: {...}
start: {...}
- line: 25
- column: 34
}end: {...}
- line: 25
- column: 36
}
}- elements: []
}- kind: "init"
}
]
}
}
]test: Literal {...}
- type: "Literal"
- start: 1183
- end: 1196
loc: {...}
start: {...}
- line: 24
- column: 8
}end: {...}
- line: 24
- column: 21
}
}- value: "RESET_POSTS"
- raw: "'RESET_POSTS'"
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Reset posts array"
- start: 1238
- end: 1258
}
]
} SwitchCase {...}
- type: "SwitchCase"
- start: 1265
- end: 1295
loc: {...}
start: {...}
- line: 26
- column: 6
}end: {...}
- line: 27
- column: 21
}
}consequent: [...] (1)
ReturnStatement {...}
- type: "ReturnStatement"
- start: 1282
- end: 1295
loc: {...}
start: {...}
- line: 27
- column: 8
}end: {...}
- line: 27
- column: 21
}
}argument: Identifier {...}
- type: "Identifier"
- start: 1289
- end: 1294
loc: {...}
start: {...}
- line: 27
- column: 15
}end: {...}
- line: 27
- column: 20
}
}- name: "state"
}
}
]- test: null
trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Return the current state if the action is not recognized"
- start: 1296
- end: 1355
}
]
}
]
}
]
}leadingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Reducer function to handle state updates"
- start: 184
- end: 227
}
]
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 1432
- end: 1922
loc: {...}
start: {...}
- line: 32
- column: 2
}end: {...}
- line: 46
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 1441
- end: 1454
loc: {...}
start: {...}
- line: 32
- column: 11
}end: {...}
- line: 32
- column: 24
}
}- name: "storeEnhancer"
}- expression: false
- generator: false
- async: false
params: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 1455
- end: 1469
loc: {...}
start: {...}
- line: 32
- column: 25
}end: {...}
- line: 32
- column: 39
}
}- name: "createStoreApi"
}
]body: BlockStatement {...}
- type: "BlockStatement"
- start: 1471
- end: 1922
loc: {...}
start: {...}
- line: 32
- column: 41
}end: {...}
- line: 46
- column: 3
}
}body: [...] (1)
ReturnStatement {...}
- type: "ReturnStatement"
- start: 1477
- end: 1918
loc: {...}
start: {...}
- line: 33
- column: 4
}end: {...}
- line: 45
- column: 6
}
}argument: FunctionExpression {...}
- type: "FunctionExpression"
- start: 1484
- end: 1917
loc: {...}
start: {...}
- line: 33
- column: 11
}end: {...}
- line: 45
- column: 5
}
}- id: null
- expression: false
- generator: false
- async: false
params: [...] (2)
Identifier {...}
- type: "Identifier"
- start: 1494
- end: 1501
loc: {...}
start: {...}
- line: 33
- column: 21
}end: {...}
- line: 33
- column: 28
}
}- name: "reducer"
} Identifier {...}
- type: "Identifier"
- start: 1503
- end: 1515
loc: {...}
start: {...}
- line: 33
- column: 30
}end: {...}
- line: 33
- column: 42
}
}- name: "initialState"
}
]body: BlockStatement {...}
- type: "BlockStatement"
- start: 1517
- end: 1917
loc: {...}
start: {...}
- line: 33
- column: 44
}end: {...}
- line: 45
- column: 5
}
}body: [...] (2)
VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 1525
- end: 1582
loc: {...}
start: {...}
- line: 34
- column: 6
}end: {...}
- line: 34
- column: 63
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 1531
- end: 1581
loc: {...}
start: {...}
- line: 34
- column: 12
}end: {...}
- line: 34
- column: 62
}
}id: Identifier {...}
- type: "Identifier"
- start: 1531
- end: 1541
loc: {...}
start: {...}
- line: 34
- column: 12
}end: {...}
- line: 34
- column: 22
}
}- name: "reduxStore"
}init: CallExpression {...}
- type: "CallExpression"
- start: 1544
- end: 1581
loc: {...}
start: {...}
- line: 34
- column: 25
}end: {...}
- line: 34
- column: 62
}
}callee: Identifier {...}
- type: "Identifier"
- start: 1544
- end: 1558
loc: {...}
start: {...}
- line: 34
- column: 25
}end: {...}
- line: 34
- column: 39
}
}- name: "createStoreApi"
}arguments: [...] (2)
Identifier {...}
- type: "Identifier"
- start: 1559
- end: 1566
loc: {...}
start: {...}
- line: 34
- column: 40
}end: {...}
- line: 34
- column: 47
}
}- name: "reducer"
} Identifier {...}
- type: "Identifier"
- start: 1568
- end: 1580
loc: {...}
start: {...}
- line: 34
- column: 49
}end: {...}
- line: 34
- column: 61
}
}- name: "initialState"
}
]- optional: false
}
}
]- kind: "const"
} ReturnStatement {...}
- type: "ReturnStatement"
- start: 1589
- end: 1911
loc: {...}
start: {...}
- line: 35
- column: 6
}end: {...}
- line: 44
- column: 8
}
}argument: ObjectExpression {...}
- type: "ObjectExpression"
- start: 1596
- end: 1910
loc: {...}
start: {...}
- line: 35
- column: 13
}end: {...}
- line: 44
- column: 7
}
}properties: [...] (2)
SpreadElement {...}
- type: "SpreadElement"
- start: 1606
- end: 1619
loc: {...}
start: {...}
- line: 36
- column: 8
}end: {...}
- line: 36
- column: 21
}
}argument: Identifier {...}
- type: "Identifier"
- start: 1609
- end: 1619
loc: {...}
start: {...}
- line: 36
- column: 11
}end: {...}
- line: 36
- column: 21
}
}- name: "reduxStore"
}
} Property {...}
- type: "Property"
- start: 1629
- end: 1901
loc: {...}
start: {...}
- line: 37
- column: 8
}end: {...}
- line: 43
- column: 9
}
}- method: true
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 1629
- end: 1638
loc: {...}
start: {...}
- line: 37
- column: 8
}end: {...}
- line: 37
- column: 17
}
}- name: "subscribe"
}- kind: "init"
value: FunctionExpression {...}
- type: "FunctionExpression"
- start: 1638
- end: 1901
loc: {...}
start: {...}
- line: 37
- column: 17
}end: {...}
- line: 43
- column: 9
}
}- id: null
- expression: false
- generator: false
- async: false
params: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 1639
- end: 1641
loc: {...}
start: {...}
- line: 37
- column: 18
}end: {...}
- line: 37
- column: 20
}
}- name: "fn"
}
]body: BlockStatement {...}
- type: "BlockStatement"
- start: 1643
- end: 1901
loc: {...}
start: {...}
- line: 37
- column: 22
}end: {...}
- line: 43
- column: 9
}
}body: [...] (2)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 1655
- end: 1681
loc: {...}
start: {...}
- line: 38
- column: 10
}end: {...}
- line: 38
- column: 36
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 1655
- end: 1680
loc: {...}
start: {...}
- line: 38
- column: 10
}end: {...}
- line: 38
- column: 35
}
}callee: Identifier {...}
- type: "Identifier"
- start: 1655
- end: 1657
loc: {...}
start: {...}
- line: 38
- column: 10
}end: {...}
- line: 38
- column: 12
}
}- name: "fn"
}arguments: [...] (1)
CallExpression {...}
- type: "CallExpression"
- start: 1658
- end: 1679
loc: {...}
start: {...}
- line: 38
- column: 13
}end: {...}
- line: 38
- column: 34
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 1658
- end: 1677
loc: {...}
start: {...}
- line: 38
- column: 13
}end: {...}
- line: 38
- column: 32
}
}object: Identifier {...}
- type: "Identifier"
- start: 1658
- end: 1668
loc: {...}
start: {...}
- line: 38
- column: 13
}end: {...}
- line: 38
- column: 23
}
}- name: "reduxStore"
}property: Identifier {...}
- type: "Identifier"
- start: 1669
- end: 1677
loc: {...}
start: {...}
- line: 38
- column: 24
}end: {...}
- line: 38
- column: 32
}
}- name: "getState"
}- computed: false
- optional: false
}- arguments: []
- optional: false
}
]- optional: false
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Call the provided function with the current state"
- start: 1682
- end: 1734
}
]
} ReturnStatement {...}
- type: "ReturnStatement"
- start: 1746
- end: 1891
loc: {...}
start: {...}
- line: 40
- column: 10
}end: {...}
- line: 42
- column: 13
}
}argument: CallExpression {...}
- type: "CallExpression"
- start: 1753
- end: 1890
loc: {...}
start: {...}
- line: 40
- column: 17
}end: {...}
- line: 42
- column: 12
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 1753
- end: 1773
loc: {...}
start: {...}
- line: 40
- column: 17
}end: {...}
- line: 40
- column: 37
}
}object: Identifier {...}
- type: "Identifier"
- start: 1753
- end: 1763
loc: {...}
start: {...}
- line: 40
- column: 17
}end: {...}
- line: 40
- column: 27
}
}- name: "reduxStore"
}property: Identifier {...}
- type: "Identifier"
- start: 1764
- end: 1773
loc: {...}
start: {...}
- line: 40
- column: 28
}end: {...}
- line: 40
- column: 37
}
}- name: "subscribe"
}- computed: false
- optional: false
}arguments: [...] (1)
ArrowFunctionExpression {...}
- type: "ArrowFunctionExpression"
- start: 1774
- end: 1889
loc: {...}
start: {...}
- line: 40
- column: 38
}end: {...}
- line: 42
- column: 11
}
}- id: null
- expression: false
- generator: false
- async: false
- params: []
body: BlockStatement {...}
- type: "BlockStatement"
- start: 1780
- end: 1889
loc: {...}
start: {...}
- line: 40
- column: 44
}end: {...}
- line: 42
- column: 11
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 1794
- end: 1820
loc: {...}
start: {...}
- line: 41
- column: 12
}end: {...}
- line: 41
- column: 38
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 1794
- end: 1819
loc: {...}
start: {...}
- line: 41
- column: 12
}end: {...}
- line: 41
- column: 37
}
}callee: Identifier {...}
- type: "Identifier"
- start: 1794
- end: 1796
loc: {...}
start: {...}
- line: 41
- column: 12
}end: {...}
- line: 41
- column: 14
}
}- name: "fn"
}arguments: [...] (1)
CallExpression {...}
- type: "CallExpression"
- start: 1797
- end: 1818
loc: {...}
start: {...}
- line: 41
- column: 15
}end: {...}
- line: 41
- column: 36
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 1797
- end: 1816
loc: {...}
start: {...}
- line: 41
- column: 15
}end: {...}
- line: 41
- column: 34
}
}object: Identifier {...}
- type: "Identifier"
- start: 1797
- end: 1807
loc: {...}
start: {...}
- line: 41
- column: 15
}end: {...}
- line: 41
- column: 25
}
}- name: "reduxStore"
}property: Identifier {...}
- type: "Identifier"
- start: 1808
- end: 1816
loc: {...}
start: {...}
- line: 41
- column: 26
}end: {...}
- line: 41
- column: 34
}
}- name: "getState"
}- computed: false
- optional: false
}- arguments: []
- optional: false
}
]- optional: false
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Call the provided function whenever the state changes"
- start: 1821
- end: 1877
}
]
}
]
}
}
]- optional: false
}
}
]
}
}
}
]
}
}
]
}
}
}
]
}leadingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Store enhancer function to enhance the store capabilities"
- start: 1369
- end: 1429
}
]
} VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 1926
- end: 1976
loc: {...}
start: {...}
- line: 48
- column: 2
}end: {...}
- line: 48
- column: 52
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 1932
- end: 1975
loc: {...}
start: {...}
- line: 48
- column: 8
}end: {...}
- line: 48
- column: 51
}
}id: Identifier {...}
- type: "Identifier"
- start: 1932
- end: 1937
loc: {...}
start: {...}
- line: 48
- column: 8
}end: {...}
- line: 48
- column: 13
}
}- name: "store"
}init: CallExpression {...}
- type: "CallExpression"
- start: 1940
- end: 1975
loc: {...}
start: {...}
- line: 48
- column: 16
}end: {...}
- line: 48
- column: 51
}
}callee: Identifier {...}
- type: "Identifier"
- start: 1940
- end: 1951
loc: {...}
start: {...}
- line: 48
- column: 16
}end: {...}
- line: 48
- column: 27
}
}- name: "createStore"
}arguments: [...] (2)
Identifier {...}
- type: "Identifier"
- start: 1952
- end: 1959
loc: {...}
start: {...}
- line: 48
- column: 28
}end: {...}
- line: 48
- column: 35
}
}- name: "reducer"
} Identifier {...}
- type: "Identifier"
- start: 1961
- end: 1974
loc: {...}
start: {...}
- line: 48
- column: 37
}end: {...}
- line: 48
- column: 50
}
}- name: "storeEnhancer"
}
]- optional: false
}
}
]- kind: "const"
trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Create the Redux store with the reducer and store enhancer"
- start: 1977
- end: 2038
}
]
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 2042
- end: 2182
loc: {...}
start: {...}
- line: 50
- column: 2
}end: {...}
- line: 52
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 2051
- end: 2067
loc: {...}
start: {...}
- line: 50
- column: 11
}end: {...}
- line: 50
- column: 27
}
}- name: "counterDecrement"
}- expression: false
- generator: false
- async: false
- params: []
body: BlockStatement {...}
- type: "BlockStatement"
- start: 2070
- end: 2182
loc: {...}
start: {...}
- line: 50
- column: 30
}end: {...}
- line: 52
- column: 3
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 2076
- end: 2122
loc: {...}
start: {...}
- line: 51
- column: 4
}end: {...}
- line: 51
- column: 50
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 2076
- end: 2121
loc: {...}
start: {...}
- line: 51
- column: 4
}end: {...}
- line: 51
- column: 49
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 2076
- end: 2090
loc: {...}
start: {...}
- line: 51
- column: 4
}end: {...}
- line: 51
- column: 18
}
}object: Identifier {...}
- type: "Identifier"
- start: 2076
- end: 2081
loc: {...}
start: {...}
- line: 51
- column: 4
}end: {...}
- line: 51
- column: 9
}
}- name: "store"
}property: Identifier {...}
- type: "Identifier"
- start: 2082
- end: 2090
loc: {...}
start: {...}
- line: 51
- column: 10
}end: {...}
- line: 51
- column: 18
}
}- name: "dispatch"
}- computed: false
- optional: false
}arguments: [...] (1)
ObjectExpression {...}
- type: "ObjectExpression"
- start: 2091
- end: 2120
loc: {...}
start: {...}
- line: 51
- column: 19
}end: {...}
- line: 51
- column: 48
}
}properties: [...] (1)
Property {...}
- type: "Property"
- start: 2093
- end: 2118
loc: {...}
start: {...}
- line: 51
- column: 21
}end: {...}
- line: 51
- column: 46
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 2093
- end: 2097
loc: {...}
start: {...}
- line: 51
- column: 21
}end: {...}
- line: 51
- column: 25
}
}- name: "type"
}value: Literal {...}
- type: "Literal"
- start: 2099
- end: 2118
loc: {...}
start: {...}
- line: 51
- column: 27
}end: {...}
- line: 51
- column: 46
}
}- value: "DECREMENT_COUNTER"
- raw: "'DECREMENT_COUNTER'"
}- kind: "init"
}
]
}
]- optional: false
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Dispatch the 'DECREMENT_COUNTER' action to the store"
- start: 2123
- end: 2178
}
]
}
]
}
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 2186
- end: 2326
loc: {...}
start: {...}
- line: 54
- column: 2
}end: {...}
- line: 56
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 2195
- end: 2211
loc: {...}
start: {...}
- line: 54
- column: 11
}end: {...}
- line: 54
- column: 27
}
}- name: "counterIncrement"
}- expression: false
- generator: false
- async: false
- params: []
body: BlockStatement {...}
- type: "BlockStatement"
- start: 2214
- end: 2326
loc: {...}
start: {...}
- line: 54
- column: 30
}end: {...}
- line: 56
- column: 3
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 2220
- end: 2266
loc: {...}
start: {...}
- line: 55
- column: 4
}end: {...}
- line: 55
- column: 50
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 2220
- end: 2265
loc: {...}
start: {...}
- line: 55
- column: 4
}end: {...}
- line: 55
- column: 49
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 2220
- end: 2234
loc: {...}
start: {...}
- line: 55
- column: 4
}end: {...}
- line: 55
- column: 18
}
}object: Identifier {...}
- type: "Identifier"
- start: 2220
- end: 2225
loc: {...}
start: {...}
- line: 55
- column: 4
}end: {...}
- line: 55
- column: 9
}
}- name: "store"
}property: Identifier {...}
- type: "Identifier"
- start: 2226
- end: 2234
loc: {...}
start: {...}
- line: 55
- column: 10
}end: {...}
- line: 55
- column: 18
}
}- name: "dispatch"
}- computed: false
- optional: false
}arguments: [...] (1)
ObjectExpression {...}
- type: "ObjectExpression"
- start: 2235
- end: 2264
loc: {...}
start: {...}
- line: 55
- column: 19
}end: {...}
- line: 55
- column: 48
}
}properties: [...] (1)
Property {...}
- type: "Property"
- start: 2237
- end: 2262
loc: {...}
start: {...}
- line: 55
- column: 21
}end: {...}
- line: 55
- column: 46
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 2237
- end: 2241
loc: {...}
start: {...}
- line: 55
- column: 21
}end: {...}
- line: 55
- column: 25
}
}- name: "type"
}value: Literal {...}
- type: "Literal"
- start: 2243
- end: 2262
loc: {...}
start: {...}
- line: 55
- column: 27
}end: {...}
- line: 55
- column: 46
}
}- value: "INCREMENT_COUNTER"
- raw: "'INCREMENT_COUNTER'"
}- kind: "init"
}
]
}
]- optional: false
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Dispatch the 'INCREMENT_COUNTER' action to the store"
- start: 2267
- end: 2322
}
]
}
]
}
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 2330
- end: 2531
loc: {...}
start: {...}
- line: 58
- column: 2
}end: {...}
- line: 60
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 2339
- end: 2363
loc: {...}
start: {...}
- line: 58
- column: 11
}end: {...}
- line: 58
- column: 35
}
}- name: "counterIncrementByAmount"
}- expression: false
- generator: false
- async: false
params: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 2364
- end: 2370
loc: {...}
start: {...}
- line: 58
- column: 36
}end: {...}
- line: 58
- column: 42
}
}- name: "amount"
}
]body: BlockStatement {...}
- type: "BlockStatement"
- start: 2372
- end: 2531
loc: {...}
start: {...}
- line: 58
- column: 44
}end: {...}
- line: 60
- column: 3
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 2378
- end: 2461
loc: {...}
start: {...}
- line: 59
- column: 4
}end: {...}
- line: 59
- column: 87
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 2378
- end: 2460
loc: {...}
start: {...}
- line: 59
- column: 4
}end: {...}
- line: 59
- column: 86
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 2378
- end: 2392
loc: {...}
start: {...}
- line: 59
- column: 4
}end: {...}
- line: 59
- column: 18
}
}object: Identifier {...}
- type: "Identifier"
- start: 2378
- end: 2383
loc: {...}
start: {...}
- line: 59
- column: 4
}end: {...}
- line: 59
- column: 9
}
}- name: "store"
}property: Identifier {...}
- type: "Identifier"
- start: 2384
- end: 2392
loc: {...}
start: {...}
- line: 59
- column: 10
}end: {...}
- line: 59
- column: 18
}
}- name: "dispatch"
}- computed: false
- optional: false
}arguments: [...] (1)
ObjectExpression {...}
- type: "ObjectExpression"
- start: 2393
- end: 2459
loc: {...}
start: {...}
- line: 59
- column: 19
}end: {...}
- line: 59
- column: 85
}
}properties: [...] (2)
Property {...}
- type: "Property"
- start: 2395
- end: 2430
loc: {...}
start: {...}
- line: 59
- column: 21
}end: {...}
- line: 59
- column: 56
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 2395
- end: 2399
loc: {...}
start: {...}
- line: 59
- column: 21
}end: {...}
- line: 59
- column: 25
}
}- name: "type"
}value: Literal {...}
- type: "Literal"
- start: 2401
- end: 2430
loc: {...}
start: {...}
- line: 59
- column: 27
}end: {...}
- line: 59
- column: 56
}
}- value: "INCREMENT_COUNTER_BY_AMOUNT"
- raw: "'INCREMENT_COUNTER_BY_AMOUNT'"
}- kind: "init"
} Property {...}
- type: "Property"
- start: 2432
- end: 2457
loc: {...}
start: {...}
- line: 59
- column: 58
}end: {...}
- line: 59
- column: 83
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 2432
- end: 2439
loc: {...}
start: {...}
- line: 59
- column: 58
}end: {...}
- line: 59
- column: 65
}
}- name: "payload"
}value: CallExpression {...}
- type: "CallExpression"
- start: 2441
- end: 2457
loc: {...}
start: {...}
- line: 59
- column: 67
}end: {...}
- line: 59
- column: 83
}
}callee: Identifier {...}
- type: "Identifier"
- start: 2441
- end: 2449
loc: {...}
start: {...}
- line: 59
- column: 67
}end: {...}
- line: 59
- column: 75
}
}- name: "parseInt"
}arguments: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 2450
- end: 2456
loc: {...}
start: {...}
- line: 59
- column: 76
}end: {...}
- line: 59
- column: 82
}
}- name: "amount"
}
]- optional: false
}- kind: "init"
}
]
}
]- optional: false
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Dispatch the 'INCREMENT_COUNTER_BY_AMOUNT' action to the store"
- start: 2462
- end: 2527
}
]
}
]
}
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 2535
- end: 2736
loc: {...}
start: {...}
- line: 62
- column: 2
}end: {...}
- line: 64
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 2544
- end: 2568
loc: {...}
start: {...}
- line: 62
- column: 11
}end: {...}
- line: 62
- column: 35
}
}- name: "counterDecrementByAmount"
}- expression: false
- generator: false
- async: false
params: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 2569
- end: 2575
loc: {...}
start: {...}
- line: 62
- column: 36
}end: {...}
- line: 62
- column: 42
}
}- name: "amount"
}
]body: BlockStatement {...}
- type: "BlockStatement"
- start: 2577
- end: 2736
loc: {...}
start: {...}
- line: 62
- column: 44
}end: {...}
- line: 64
- column: 3
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 2583
- end: 2666
loc: {...}
start: {...}
- line: 63
- column: 4
}end: {...}
- line: 63
- column: 87
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 2583
- end: 2665
loc: {...}
start: {...}
- line: 63
- column: 4
}end: {...}
- line: 63
- column: 86
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 2583
- end: 2597
loc: {...}
start: {...}
- line: 63
- column: 4
}end: {...}
- line: 63
- column: 18
}
}object: Identifier {...}
- type: "Identifier"
- start: 2583
- end: 2588
loc: {...}
start: {...}
- line: 63
- column: 4
}end: {...}
- line: 63
- column: 9
}
}- name: "store"
}property: Identifier {...}
- type: "Identifier"
- start: 2589
- end: 2597
loc: {...}
start: {...}
- line: 63
- column: 10
}end: {...}
- line: 63
- column: 18
}
}- name: "dispatch"
}- computed: false
- optional: false
}arguments: [...] (1)
ObjectExpression {...}
- type: "ObjectExpression"
- start: 2598
- end: 2664
loc: {...}
start: {...}
- line: 63
- column: 19
}end: {...}
- line: 63
- column: 85
}
}properties: [...] (2)
Property {...}
- type: "Property"
- start: 2600
- end: 2635
loc: {...}
start: {...}
- line: 63
- column: 21
}end: {...}
- line: 63
- column: 56
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 2600
- end: 2604
loc: {...}
start: {...}
- line: 63
- column: 21
}end: {...}
- line: 63
- column: 25
}
}- name: "type"
}value: Literal {...}
- type: "Literal"
- start: 2606
- end: 2635
loc: {...}
start: {...}
- line: 63
- column: 27
}end: {...}
- line: 63
- column: 56
}
}- value: "DECREMENT_COUNTER_BY_AMOUNT"
- raw: "'DECREMENT_COUNTER_BY_AMOUNT'"
}- kind: "init"
} Property {...}
- type: "Property"
- start: 2637
- end: 2662
loc: {...}
start: {...}
- line: 63
- column: 58
}end: {...}
- line: 63
- column: 83
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 2637
- end: 2644
loc: {...}
start: {...}
- line: 63
- column: 58
}end: {...}
- line: 63
- column: 65
}
}- name: "payload"
}value: CallExpression {...}
- type: "CallExpression"
- start: 2646
- end: 2662
loc: {...}
start: {...}
- line: 63
- column: 67
}end: {...}
- line: 63
- column: 83
}
}callee: Identifier {...}
- type: "Identifier"
- start: 2646
- end: 2654
loc: {...}
start: {...}
- line: 63
- column: 67
}end: {...}
- line: 63
- column: 75
}
}- name: "parseInt"
}arguments: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 2655
- end: 2661
loc: {...}
start: {...}
- line: 63
- column: 76
}end: {...}
- line: 63
- column: 82
}
}- name: "amount"
}
]- optional: false
}- kind: "init"
}
]
}
]- optional: false
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Dispatch the 'DECREMENT_COUNTER_BY_AMOUNT' action to the store"
- start: 2667
- end: 2732
}
]
}
]
}
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 2740
- end: 2816
loc: {...}
start: {...}
- line: 66
- column: 2
}end: {...}
- line: 68
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 2749
- end: 2761
loc: {...}
start: {...}
- line: 66
- column: 11
}end: {...}
- line: 66
- column: 23
}
}- name: "counterReset"
}- expression: false
- generator: false
- async: false
- params: []
body: BlockStatement {...}
- type: "BlockStatement"
- start: 2764
- end: 2816
loc: {...}
start: {...}
- line: 66
- column: 26
}end: {...}
- line: 68
- column: 3
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 2770
- end: 2812
loc: {...}
start: {...}
- line: 67
- column: 4
}end: {...}
- line: 67
- column: 46
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 2770
- end: 2811
loc: {...}
start: {...}
- line: 67
- column: 4
}end: {...}
- line: 67
- column: 45
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 2770
- end: 2784
loc: {...}
start: {...}
- line: 67
- column: 4
}end: {...}
- line: 67
- column: 18
}
}object: Identifier {...}
- type: "Identifier"
- start: 2770
- end: 2775
loc: {...}
start: {...}
- line: 67
- column: 4
}end: {...}
- line: 67
- column: 9
}
}- name: "store"
}property: Identifier {...}
- type: "Identifier"
- start: 2776
- end: 2784
loc: {...}
start: {...}
- line: 67
- column: 10
}end: {...}
- line: 67
- column: 18
}
}- name: "dispatch"
}- computed: false
- optional: false
}arguments: [...] (1)
ObjectExpression {...}
- type: "ObjectExpression"
- start: 2785
- end: 2810
loc: {...}
start: {...}
- line: 67
- column: 19
}end: {...}
- line: 67
- column: 44
}
}properties: [...] (1)
Property {...}
- type: "Property"
- start: 2787
- end: 2808
loc: {...}
start: {...}
- line: 67
- column: 21
}end: {...}
- line: 67
- column: 42
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 2787
- end: 2791
loc: {...}
start: {...}
- line: 67
- column: 21
}end: {...}
- line: 67
- column: 25
}
}- name: "type"
}value: Literal {...}
- type: "Literal"
- start: 2793
- end: 2808
loc: {...}
start: {...}
- line: 67
- column: 27
}end: {...}
- line: 67
- column: 42
}
}- value: "RESET_COUNTER"
- raw: "'RESET_COUNTER'"
}- kind: "init"
}
]
}
]- optional: false
}
}
]
}
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 2820
- end: 2869
loc: {...}
start: {...}
- line: 70
- column: 2
}end: {...}
- line: 72
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 2829
- end: 2840
loc: {...}
start: {...}
- line: 70
- column: 11
}end: {...}
- line: 70
- column: 22
}
}- name: "resetAmount"
}- expression: false
- generator: false
- async: false
- params: []
body: BlockStatement {...}
- type: "BlockStatement"
- start: 2843
- end: 2869
loc: {...}
start: {...}
- line: 70
- column: 25
}end: {...}
- line: 72
- column: 3
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 2849
- end: 2865
loc: {...}
start: {...}
- line: 71
- column: 4
}end: {...}
- line: 71
- column: 20
}
}expression: AssignmentExpression {...}
- type: "AssignmentExpression"
- start: 2849
- end: 2864
loc: {...}
start: {...}
- line: 71
- column: 4
}end: {...}
- line: 71
- column: 19
}
}- operator: "="
left: Identifier {...}
- type: "Identifier"
- start: 2849
- end: 2860
loc: {...}
start: {...}
- line: 71
- column: 4
}end: {...}
- line: 71
- column: 15
}
}- name: "amountValue"
}right: Literal {...}
- type: "Literal"
- start: 2863
- end: 2864
loc: {...}
start: {...}
- line: 71
- column: 18
}end: {...}
- line: 71
- column: 19
}
}- value: 0
- raw: "0"
}
}
}
]
}
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 2873
- end: 3046
loc: {...}
start: {...}
- line: 74
- column: 2
}end: {...}
- line: 77
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 2882
- end: 2893
loc: {...}
start: {...}
- line: 74
- column: 11
}end: {...}
- line: 74
- column: 22
}
}- name: "handleInput"
}- expression: false
- generator: false
- async: false
params: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 2894
- end: 2899
loc: {...}
start: {...}
- line: 74
- column: 23
}end: {...}
- line: 74
- column: 28
}
}- name: "event"
}
]body: BlockStatement {...}
- type: "BlockStatement"
- start: 2901
- end: 3046
loc: {...}
start: {...}
- line: 74
- column: 30
}end: {...}
- line: 77
- column: 3
}
}body: [...] (2)
VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 2907
- end: 2970
loc: {...}
start: {...}
- line: 75
- column: 4
}end: {...}
- line: 75
- column: 67
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 2913
- end: 2969
loc: {...}
start: {...}
- line: 75
- column: 10
}end: {...}
- line: 75
- column: 66
}
}id: Identifier {...}
- type: "Identifier"
- start: 2913
- end: 2925
loc: {...}
start: {...}
- line: 75
- column: 10
}end: {...}
- line: 75
- column: 22
}
}- name: "numericValue"
}init: CallExpression {...}
- type: "CallExpression"
- start: 2928
- end: 2969
loc: {...}
start: {...}
- line: 75
- column: 25
}end: {...}
- line: 75
- column: 66
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 2928
- end: 2954
loc: {...}
start: {...}
- line: 75
- column: 25
}end: {...}
- line: 75
- column: 51
}
}object: MemberExpression {...}
- type: "MemberExpression"
- start: 2928
- end: 2946
loc: {...}
start: {...}
- line: 75
- column: 25
}end: {...}
- line: 75
- column: 43
}
}object: MemberExpression {...}
- type: "MemberExpression"
- start: 2928
- end: 2940
loc: {...}
start: {...}
- line: 75
- column: 25
}end: {...}
- line: 75
- column: 37
}
}object: Identifier {...}
- type: "Identifier"
- start: 2928
- end: 2933
loc: {...}
start: {...}
- line: 75
- column: 25
}end: {...}
- line: 75
- column: 30
}
}- name: "event"
}property: Identifier {...}
- type: "Identifier"
- start: 2934
- end: 2940
loc: {...}
start: {...}
- line: 75
- column: 31
}end: {...}
- line: 75
- column: 37
}
}- name: "target"
}- computed: false
- optional: false
}property: Identifier {...}
- type: "Identifier"
- start: 2941
- end: 2946
loc: {...}
start: {...}
- line: 75
- column: 38
}end: {...}
- line: 75
- column: 43
}
}- name: "value"
}- computed: false
- optional: false
}property: Identifier {...}
- type: "Identifier"
- start: 2947
- end: 2954
loc: {...}
start: {...}
- line: 75
- column: 44
}end: {...}
- line: 75
- column: 51
}
}- name: "replace"
}- computed: false
- optional: false
}arguments: [...] (2)
Literal {...}
- type: "Literal"
- start: 2955
- end: 2964
loc: {...}
start: {...}
- line: 75
- column: 52
}end: {...}
- line: 75
- column: 61
}
}value: {...}
}- raw: "/[^0-9]/g"
regex: {...}
- pattern: "[^0-9]"
- flags: "g"
}
} Literal {...}
- type: "Literal"
- start: 2966
- end: 2968
loc: {...}
start: {...}
- line: 75
- column: 63
}end: {...}
- line: 75
- column: 65
}
}- value: ""
- raw: "''"
}
]- optional: false
}
}
]- kind: "const"
} ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 2975
- end: 3042
loc: {...}
start: {...}
- line: 76
- column: 4
}end: {...}
- line: 76
- column: 71
}
}expression: AssignmentExpression {...}
- type: "AssignmentExpression"
- start: 2975
- end: 3041
loc: {...}
start: {...}
- line: 76
- column: 4
}end: {...}
- line: 76
- column: 70
}
}- operator: "="
left: Identifier {...}
- type: "Identifier"
- start: 2975
- end: 2986
loc: {...}
start: {...}
- line: 76
- column: 4
}end: {...}
- line: 76
- column: 15
}
}- name: "amountValue"
}right: ConditionalExpression {...}
- type: "ConditionalExpression"
- start: 2989
- end: 3041
loc: {...}
start: {...}
- line: 76
- column: 18
}end: {...}
- line: 76
- column: 70
}
}test: BinaryExpression {...}
- type: "BinaryExpression"
- start: 2989
- end: 3008
loc: {...}
start: {...}
- line: 76
- column: 18
}end: {...}
- line: 76
- column: 37
}
}left: Identifier {...}
- type: "Identifier"
- start: 2989
- end: 3001
loc: {...}
start: {...}
- line: 76
- column: 18
}end: {...}
- line: 76
- column: 30
}
}- name: "numericValue"
}- operator: "==="
right: Literal {...}
- type: "Literal"
- start: 3006
- end: 3008
loc: {...}
start: {...}
- line: 76
- column: 35
}end: {...}
- line: 76
- column: 37
}
}- value: ""
- raw: "''"
}
}consequent: Literal {...}
- type: "Literal"
- start: 3011
- end: 3012
loc: {...}
start: {...}
- line: 76
- column: 40
}end: {...}
- line: 76
- column: 41
}
}- value: 0
- raw: "0"
}alternate: CallExpression {...}
- type: "CallExpression"
- start: 3015
- end: 3041
loc: {...}
start: {...}
- line: 76
- column: 44
}end: {...}
- line: 76
- column: 70
}
}callee: Identifier {...}
- type: "Identifier"
- start: 3015
- end: 3023
loc: {...}
start: {...}
- line: 76
- column: 44
}end: {...}
- line: 76
- column: 52
}
}- name: "parseInt"
}arguments: [...] (2)
Identifier {...}
- type: "Identifier"
- start: 3024
- end: 3036
loc: {...}
start: {...}
- line: 76
- column: 53
}end: {...}
- line: 76
- column: 65
}
}- name: "numericValue"
} Literal {...}
- type: "Literal"
- start: 3038
- end: 3040
loc: {...}
start: {...}
- line: 76
- column: 67
}end: {...}
- line: 76
- column: 69
}
}- value: 10
- raw: "10"
}
]- optional: false
}
}
}
}
]
}
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 3050
- end: 3439
loc: {...}
start: {...}
- line: 79
- column: 2
}end: {...}
- line: 88
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 3059
- end: 3069
loc: {...}
start: {...}
- line: 79
- column: 11
}end: {...}
- line: 79
- column: 21
}
}- name: "fetchPosts"
}- expression: false
- generator: false
- async: false
- params: []
body: BlockStatement {...}
- type: "BlockStatement"
- start: 3072
- end: 3439
loc: {...}
start: {...}
- line: 79
- column: 24
}end: {...}
- line: 88
- column: 3
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 3078
- end: 3435
loc: {...}
start: {...}
- line: 80
- column: 4
}end: {...}
- line: 87
- column: 9
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 3078
- end: 3434
loc: {...}
start: {...}
- line: 80
- column: 4
}end: {...}
- line: 87
- column: 8
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 3078
- end: 3357
loc: {...}
start: {...}
- line: 80
- column: 4
}end: {...}
- line: 85
- column: 12
}
}object: CallExpression {...}
- type: "CallExpression"
- start: 3078
- end: 3344
loc: {...}
start: {...}
- line: 80
- column: 4
}end: {...}
- line: 84
- column: 8
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 3078
- end: 3184
loc: {...}
start: {...}
- line: 80
- column: 4
}end: {...}
- line: 82
- column: 11
}
}object: CallExpression {...}
- type: "CallExpression"
- start: 3078
- end: 3172
loc: {...}
start: {...}
- line: 80
- column: 4
}end: {...}
- line: 81
- column: 42
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 3078
- end: 3141
loc: {...}
start: {...}
- line: 80
- column: 4
}end: {...}
- line: 81
- column: 11
}
}object: CallExpression {...}
- type: "CallExpression"
- start: 3078
- end: 3129
loc: {...}
start: {...}
- line: 80
- column: 4
}end: {...}
- line: 80
- column: 55
}
}callee: Identifier {...}
- type: "Identifier"
- start: 3078
- end: 3083
loc: {...}
start: {...}
- line: 80
- column: 4
}end: {...}
- line: 80
- column: 9
}
}- name: "fetch"
}arguments: [...] (1)
Literal {...}
- type: "Literal"
- start: 3084
- end: 3128
loc: {...}
start: {...}
- line: 80
- column: 10
}end: {...}
- line: 80
- column: 54
}
}- value: "https://jsonplaceholder.typicode.com/posts"
- raw: "'https://jsonplaceholder.typicode.com/posts'"
}
]- optional: false
}property: Identifier {...}
- type: "Identifier"
- start: 3137
- end: 3141
loc: {...}
start: {...}
- line: 81
- column: 7
}end: {...}
- line: 81
- column: 11
}
}- name: "then"
}- computed: false
- optional: false
}arguments: [...] (1)
ArrowFunctionExpression {...}
- type: "ArrowFunctionExpression"
- start: 3142
- end: 3171
loc: {...}
start: {...}
- line: 81
- column: 12
}end: {...}
- line: 81
- column: 41
}
}- id: null
- expression: true
- generator: false
- async: false
params: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 3143
- end: 3151
loc: {...}
start: {...}
- line: 81
- column: 13
}end: {...}
- line: 81
- column: 21
}
}- name: "response"
}
]body: CallExpression {...}
- type: "CallExpression"
- start: 3156
- end: 3171
loc: {...}
start: {...}
- line: 81
- column: 26
}end: {...}
- line: 81
- column: 41
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 3156
- end: 3169
loc: {...}
start: {...}
- line: 81
- column: 26
}end: {...}
- line: 81
- column: 39
}
}object: Identifier {...}
- type: "Identifier"
- start: 3156
- end: 3164
loc: {...}
start: {...}
- line: 81
- column: 26
}end: {...}
- line: 81
- column: 34
}
}- name: "response"
}property: Identifier {...}
- type: "Identifier"
- start: 3165
- end: 3169
loc: {...}
start: {...}
- line: 81
- column: 35
}end: {...}
- line: 81
- column: 39
}
}- name: "json"
}- computed: false
- optional: false
}- arguments: []
- optional: false
}
}
]- optional: false
}property: Identifier {...}
- type: "Identifier"
- start: 3180
- end: 3184
loc: {...}
start: {...}
- line: 82
- column: 7
}end: {...}
- line: 82
- column: 11
}
}- name: "then"
}- computed: false
- optional: false
}arguments: [...] (1)
ArrowFunctionExpression {...}
- type: "ArrowFunctionExpression"
- start: 3185
- end: 3343
loc: {...}
start: {...}
- line: 82
- column: 12
}end: {...}
- line: 84
- column: 7
}
}- id: null
- expression: false
- generator: false
- async: false
params: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 3186
- end: 3190
loc: {...}
start: {...}
- line: 82
- column: 13
}end: {...}
- line: 82
- column: 17
}
}- name: "data"
}
]body: BlockStatement {...}
- type: "BlockStatement"
- start: 3195
- end: 3343
loc: {...}
start: {...}
- line: 82
- column: 22
}end: {...}
- line: 84
- column: 7
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 3205
- end: 3268
loc: {...}
start: {...}
- line: 83
- column: 8
}end: {...}
- line: 83
- column: 71
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 3205
- end: 3267
loc: {...}
start: {...}
- line: 83
- column: 8
}end: {...}
- line: 83
- column: 70
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 3205
- end: 3219
loc: {...}
start: {...}
- line: 83
- column: 8
}end: {...}
- line: 83
- column: 22
}
}object: Identifier {...}
- type: "Identifier"
- start: 3205
- end: 3210
loc: {...}
start: {...}
- line: 83
- column: 8
}end: {...}
- line: 83
- column: 13
}
}- name: "store"
}property: Identifier {...}
- type: "Identifier"
- start: 3211
- end: 3219
loc: {...}
start: {...}
- line: 83
- column: 14
}end: {...}
- line: 83
- column: 22
}
}- name: "dispatch"
}- computed: false
- optional: false
}arguments: [...] (1)
ObjectExpression {...}
- type: "ObjectExpression"
- start: 3220
- end: 3266
loc: {...}
start: {...}
- line: 83
- column: 23
}end: {...}
- line: 83
- column: 69
}
}properties: [...] (2)
Property {...}
- type: "Property"
- start: 3222
- end: 3249
loc: {...}
start: {...}
- line: 83
- column: 25
}end: {...}
- line: 83
- column: 52
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 3222
- end: 3226
loc: {...}
start: {...}
- line: 83
- column: 25
}end: {...}
- line: 83
- column: 29
}
}- name: "type"
}value: Literal {...}
- type: "Literal"
- start: 3228
- end: 3249
loc: {...}
start: {...}
- line: 83
- column: 31
}end: {...}
- line: 83
- column: 52
}
}- value: "FETCH_POSTS_SUCCESS"
- raw: "'FETCH_POSTS_SUCCESS'"
}- kind: "init"
} Property {...}
- type: "Property"
- start: 3251
- end: 3264
loc: {...}
start: {...}
- line: 83
- column: 54
}end: {...}
- line: 83
- column: 67
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 3251
- end: 3258
loc: {...}
start: {...}
- line: 83
- column: 54
}end: {...}
- line: 83
- column: 61
}
}- name: "payload"
}value: Identifier {...}
- type: "Identifier"
- start: 3260
- end: 3264
loc: {...}
start: {...}
- line: 83
- column: 63
}end: {...}
- line: 83
- column: 67
}
}- name: "data"
}- kind: "init"
}
]
}
]- optional: false
}trailingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Dispatch the 'FETCH_POSTS_SUCCESS' action with the fetched data"
- start: 3269
- end: 3335
}
]
}
]
}
}
]- optional: false
}property: Identifier {...}
- type: "Identifier"
- start: 3352
- end: 3357
loc: {...}
start: {...}
- line: 85
- column: 7
}end: {...}
- line: 85
- column: 12
}
}- name: "catch"
}- computed: false
- optional: false
}arguments: [...] (1)
ArrowFunctionExpression {...}
- type: "ArrowFunctionExpression"
- start: 3358
- end: 3433
loc: {...}
start: {...}
- line: 85
- column: 13
}end: {...}
- line: 87
- column: 7
}
}- id: null
- expression: false
- generator: false
- async: false
params: [...] (1)
Identifier {...}
- type: "Identifier"
- start: 3359
- end: 3364
loc: {...}
start: {...}
- line: 85
- column: 14
}end: {...}
- line: 85
- column: 19
}
}- name: "error"
}
]body: BlockStatement {...}
- type: "BlockStatement"
- start: 3369
- end: 3433
loc: {...}
start: {...}
- line: 85
- column: 24
}end: {...}
- line: 87
- column: 7
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 3379
- end: 3425
loc: {...}
start: {...}
- line: 86
- column: 8
}end: {...}
- line: 86
- column: 54
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 3379
- end: 3424
loc: {...}
start: {...}
- line: 86
- column: 8
}end: {...}
- line: 86
- column: 53
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 3379
- end: 3392
loc: {...}
start: {...}
- line: 86
- column: 8
}end: {...}
- line: 86
- column: 21
}
}object: Identifier {...}
- type: "Identifier"
- start: 3379
- end: 3386
loc: {...}
start: {...}
- line: 86
- column: 8
}end: {...}
- line: 86
- column: 15
}
}- name: "console"
}property: Identifier {...}
- type: "Identifier"
- start: 3387
- end: 3392
loc: {...}
start: {...}
- line: 86
- column: 16
}end: {...}
- line: 86
- column: 21
}
}- name: "error"
}- computed: false
- optional: false
}arguments: [...] (2)
Literal {...}
- type: "Literal"
- start: 3393
- end: 3416
loc: {...}
start: {...}
- line: 86
- column: 22
}end: {...}
- line: 86
- column: 45
}
}- value: "Error fetching posts:"
- raw: "'Error fetching posts:'"
} Identifier {...}
- type: "Identifier"
- start: 3418
- end: 3423
loc: {...}
start: {...}
- line: 86
- column: 47
}end: {...}
- line: 86
- column: 52
}
}- name: "error"
}
]- optional: false
}
}
]
}
}
]- optional: false
}
}
]
}
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 3493
- end: 3545
loc: {...}
start: {...}
- line: 92
- column: 2
}end: {...}
- line: 94
- column: 3
}
}id: Identifier {...}
- type: "Identifier"
- start: 3502
- end: 3519
loc: {...}
start: {...}
- line: 92
- column: 11
}end: {...}
- line: 92
- column: 28
}
}- name: "triggerFetchPosts"
}- expression: false
- generator: false
- async: false
- params: []
body: BlockStatement {...}
- type: "BlockStatement"
- start: 3522
- end: 3545
loc: {...}
start: {...}
- line: 92
- column: 31
}end: {...}
- line: 94
- column: 3
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 3528
- end: 3541
loc: {...}
start: {...}
- line: 93
- column: 4
}end: {...}
- line: 93
- column: 17
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 3528
- end: 3540
loc: {...}
start: {...}
- line: 93
- column: 4
}end: {...}
- line: 93
- column: 16
}
}callee: Identifier {...}
- type: "Identifier"
- start: 3528
- end: 3538
loc: {...}
start: {...}
- line: 93
- column: 4
}end: {...}
- line: 93
- column: 14
}
}- name: "fetchPosts"
}- arguments: []
- optional: false
}
}
]
}leadingComments: [...] (1)
Line {...}
- type: "Line"
- value: " Manually trigger the fetchPosts() function"
- start: 3443
- end: 3488
}
]
} FunctionDeclaration {...}
- type: "FunctionDeclaration"
- start: 3549
- end: 3618
loc: {...}
start: {...}
- line: 96
- column: 1
}end: {...}
- line: 98
- column: 2
}
}id: Identifier {...}
- type: "Identifier"
- start: 3558
- end: 3568
loc: {...}
start: {...}
- line: 96
- column: 10
}end: {...}
- line: 96
- column: 20
}
}- name: "resetPosts"
}- expression: false
- generator: false
- async: false
- params: []
body: BlockStatement {...}
- type: "BlockStatement"
- start: 3571
- end: 3618
loc: {...}
start: {...}
- line: 96
- column: 23
}end: {...}
- line: 98
- column: 2
}
}body: [...] (1)
ExpressionStatement {...}
- type: "ExpressionStatement"
- start: 3575
- end: 3615
loc: {...}
start: {...}
- line: 97
- column: 2
}end: {...}
- line: 97
- column: 42
}
}expression: CallExpression {...}
- type: "CallExpression"
- start: 3575
- end: 3614
loc: {...}
start: {...}
- line: 97
- column: 2
}end: {...}
- line: 97
- column: 41
}
}callee: MemberExpression {...}
- type: "MemberExpression"
- start: 3575
- end: 3589
loc: {...}
start: {...}
- line: 97
- column: 2
}end: {...}
- line: 97
- column: 16
}
}object: Identifier {...}
- type: "Identifier"
- start: 3575
- end: 3580
loc: {...}
start: {...}
- line: 97
- column: 2
}end: {...}
- line: 97
- column: 7
}
}- name: "store"
}property: Identifier {...}
- type: "Identifier"
- start: 3581
- end: 3589
loc: {...}
start: {...}
- line: 97
- column: 8
}end: {...}
- line: 97
- column: 16
}
}- name: "dispatch"
}- computed: false
- optional: false
}arguments: [...] (1)
ObjectExpression {...}
- type: "ObjectExpression"
- start: 3590
- end: 3613
loc: {...}
start: {...}
- line: 97
- column: 17
}end: {...}
- line: 97
- column: 40
}
}properties: [...] (1)
Property {...}
- type: "Property"
- start: 3592
- end: 3611
loc: {...}
start: {...}
- line: 97
- column: 19
}end: {...}
- line: 97
- column: 38
}
}- method: false
- shorthand: false
- computed: false
key: Identifier {...}
- type: "Identifier"
- start: 3592
- end: 3596
loc: {...}
start: {...}
- line: 97
- column: 19
}end: {...}
- line: 97
- column: 23
}
}- name: "type"
}value: Literal {...}
- type: "Literal"
- start: 3598
- end: 3611
loc: {...}
start: {...}
- line: 97
- column: 25
}end: {...}
- line: 97
- column: 38
}
}- value: "RESET_POSTS"
- raw: "'RESET_POSTS'"
}- kind: "init"
}
]
}
]- optional: false
}
}
]
}
} VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 3622
- end: 3642
loc: {...}
start: {...}
- line: 100
- column: 1
}end: {...}
- line: 100
- column: 21
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 3626
- end: 3641
loc: {...}
start: {...}
- line: 100
- column: 5
}end: {...}
- line: 100
- column: 20
}
}id: Identifier {...}
- type: "Identifier"
- start: 3626
- end: 3637
loc: {...}
start: {...}
- line: 100
- column: 5
}end: {...}
- line: 100
- column: 16
}
}- name: "amountValue"
}init: Literal {...}
- type: "Literal"
- start: 3640
- end: 3641
loc: {...}
start: {...}
- line: 100
- column: 19
}end: {...}
- line: 100
- column: 20
}
}- value: 1
- raw: "1"
}
}
]- kind: "let"
}
]- sourceType: "module"
}- attributes: []
}
}
The AST is not public API and may change at any point in time