someState is how you read the current value of your state -> console.log(someState)
setSomeState is how you update the current value of your state -> setSomeState(NEW_STATE)
DEFAULT_VALUE is the value that someState will have on the initial render, and every subsequent re-renders until setSomeState is called.
The DEFAULT_VALUE should either be the empty version of whatever type someState will take. For example if you know that someState will eventually be an array of multiple elements. The DEFAULT_VALUE should be an empty array. Same goes for if it will eventually be a string of text, the DEFAULT_VALUE should then be an empty string
Distribution Builds
parcel build src/index.html
One feature of parcel is that it will create an optimized version for the browser
It transpiles the code for an app and "uglifies" it, in a very condensed, minified, and simpler syntax. You can see this build in the dist directory
It also stores these builds in the cache so that any subsequent builds will not take as long as the first. You can find this cache in the cache directory
08/26 Day 22 Lecture Notes
useState
recapsomeState
is how you read the current value of yourstate
->console.log(someState)
setSomeState
is how you update the current value of yourstate
->setSomeState(NEW_STATE)
DEFAULT_VALUE
is the value thatsomeState
will have on the initial render, and every subsequent re-renders untilsetSomeState
is called.DEFAULT_VALUE
should either be the empty version of whatever typesomeState
will take. For example if you know thatsomeState
will eventually be anarray
of multiple elements. TheDEFAULT_VALUE
should be an emptyarray
. Same goes for if it will eventually be astring
of text, theDEFAULT_VALUE
should then be an emptystring
Distribution Builds
parcel
is that it will create an optimized version for the browserdist
directorycache
directory