You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A shopping list is a set of items associated with a specific three-word token. We need to allow users to start new lists, so they can save the things they need to buy. To start a new list, we will need to do a few things:
Generate a new, unique token
Save the token to localStorage
Show the user the list view
Up to this point, the app has rendered the items in the list associated with the token my test list. Before we can allow users to make new lists, we have to stop showing them this test list.
Acceptance criteria
@the-collab-lab/shopping-list-utils is added as a dependency to the project.
The string my test list in App.jsx is replaced with null, so users are not automatically subscribed to any list.
If a user doesn’t already have a token:
A button in the Home component allows them to create a new list
Clicking the button generates a new token and saves it to localStorage using the setListToken function in App.jsx.
Once the token has been created and saved, the user is redirected to the List view.
If a user does already have a token:
They are automatically redirected to the List view.
Notes
The generateToken function from the shopping-list-utils package should be used to generate the token. More information on that package its documentation. Importing it will look something like this:
The setListToken function takes one argument: the new list token.
Eventually the welcome/home page will look like this wireframe. It’s good for your whole team to look at the wireframe now, but be sure not to try to implement all of the visible functionality at once. There will be future stories to add the other features such as joining an existing list.
For this story, it's sufficient just to have a simple "create list" button. Although you are not required to save the token to Firestore, some teams have opted to also save the token to Firestore when generating a token.
The text was updated successfully, but these errors were encountered:
Summary
A shopping list is a set of items associated with a specific three-word token. We need to allow users to start new lists, so they can save the things they need to buy. To start a new list, we will need to do a few things:
localStorage
Up to this point, the app has rendered the items in the list associated with the token
my test list
. Before we can allow users to make new lists, we have to stop showing them this test list.Acceptance criteria
@the-collab-lab/shopping-list-utils
is added as a dependency to the project.my test list
inApp.jsx
is replaced withnull
, so users are not automatically subscribed to any list.If a user doesn’t already have a token:
Home
component allows them to create a new listlocalStorage
using thesetListToken
function inApp.jsx
.List
view.If a user does already have a token:
List
view.Notes
generateToken
function from theshopping-list-utils
package should be used to generate the token. More information on that package its documentation. Importing it will look something like this:setListToken
function takes one argument: the new list token.The text was updated successfully, but these errors were encountered: