I want you to setup redux-toolkit boilerplate with persistor and thunk.
Currently I want to create a single Slice which contains the following state:
Note: the number of player-unique-hash-id's found inside playerRecords can vary. but the usual limit is x>=1. As for the limit of objects inside player-unique-hash-id's array, is 0<x<10.
{
sessionId: "some-random-string",
playerRecords: {
"player-1s-unique-hash-id": [
{
question: "some random question 1",
response: "players response to question 1"
},
{
question: "some random question 2",
response: "players response to question 2"
},
{
question: "some random question 3",
response: "players response to question 3"
},
{
question: "some random question 4",
response: "players response to question 4"
}
] ,
"player-2s-unique-hash-id": [
{
question: "some random question 1",
response: "players response to question 1"
},
{
question: "some random question 2",
response: "players response to question 2"
},
{
question: "some random question 3",
response: "players response to question 3"
},
{
question: "some random question 4",
response: "players response to question 4"
}
] ,
...
}
}
Actions for this state will be the following:
An action to add/append a player's response to a question, against their hash-id.
An action to append a key inside playerRecords object which represents a player's unique ID. Initialize it with an empty array [].
Make sure the exported action functions have Actions at the end of their names. For examples addPlayerAction() or addPlayerResponseAction()
I want you to setup redux-toolkit boilerplate with
persistor
andthunk
.Currently I want to create a single Slice which contains the following state:
Actions for this state will be the following:
playerRecords
object which represents a player's unique ID. Initialize it with an empty array [].Make sure the exported action functions have
Actions
at the end of their names. For examplesaddPlayerAction()
oraddPlayerResponseAction()