---
# System prepended metadata

title: '2003-GHP Cookie Jar: Redux'

---

# 2003-GHP Cookie Jar: Redux

Put your pending and outstanding questions here 👇
Make the question in H2 tag by using '##'

Example:

## What is JavaScript?

## What is your space history? you said your background was fitting for you history

## Answer

I am not sure what you mean by this. May you please you rephrase?

## these nested middleware functions are a bit confusing...

## Answer

Yes, I understand. It will take some time getting used to. Did you have a more specific question? Otherwise, I uploaded the code demo from this morning. Play around with it! 


## How does a store have access to state? When I console.log store, it just shows an object containing dispatch and other methods.
![](https://i.imgur.com/0ipo8vi.png)

## Answer

Yeah! In the live demo, we showed what functions the `store` gives us. Check out the [diagram](https://app.diagrams.net/?page-id=KBTJCIe4dOHuXAzcSy1W#G1HQMHTMmcFN-2Jv2WlFU5Ioyc18EP_pmd) we made yesterday to get the idea of what is given and what we create in regards to Redux.

So, that `getState()` function is the function that `store` uses to grab the current state of our application. 


## In the Pixelate-Redux lab, how are we able to serve up our html in our localhost:8080? Couldn't find any docs that did that.

![](https://i.imgur.com/hmDwGMM.png)

## Answer

Please, let me know if this answers your question. See screencap below. 

![](https://i.imgur.com/JJBhubo.png)

In our `package.json`, we have a few set of scripts. We have the `start`, `serve`, `build-watch` scripts. Remember: These are scripts we can create. I've done a few live demos where I created a script like `"start": nodemon index.js` so I didn't have to run `nodemon index.js` over and over again and can just do `npm start` or `npm run start`.

So, in the scripts section, we have a `start` script that runs `build-watch` another script that is created that runs `webpack -w` (-w means "watch" for file system changes. More info on the [webpack docs](https://webpack.js.org/api/cli/)) AND in that same `start` script, we are also running `npm run serve`, and `serve` is yet another script which runs `http-server` which is how we are able to "server" our app to localhost:8080. Check out the `http-server` [landing page docs](https://www.npmjs.com/package/http-server)

Don't worry about caching and the `c-1` command. But notice how it defaults to port 8080
![](https://i.imgur.com/fmiBYhF.png)

## With the Redux, we will manage the App state. Then what about if there is separate/ additional local state..? Is it going to be handled by react stuffs not redux for local state..?

## Answer

Noelle went over this yesterday! She talked about forms and how that we would use local state to manage the form state. React is handling that. However, when we submit the form to say create data (POST request), we would be using our `thunks` for that what Julissa taught today.

But at a general level, local state is something React handles. Redux is meant to be a global centralized state that our components can grab as necessary. 


