Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
@misk/simpleredux
Advanced tools
Readme
Using Redux can be simple.
@misk/SimpleRedux
includes all the Redux parts necessary for forms, network requests, and other interactive components. Don't write Redux boilerplate for basic interactivity again.
$ npm install @misk/simpleredux
Allows for single-key cached selection from Redux state
Most directly equivalent to deprecated simpleSelect
// OLD
const field1 = simpleSelect(props.simpleForm, "Dino::Field1", "data")
const tagsField = simpleSelect(props.simpleForm, "Dino::Tags", "data", simpleType.array)
// NEW
const field1 = simpleSelectorGet(props.simpleForm, ["Dino::Field1", "data"])
const tagsField = simpleSelectorGet(props.simpleForm, ["Dino::Tags", "data"], [])
simpleSelectorGet
subState
: same as parameter 1 for simpleSelect
. Example: props.simpleForm
, props.simpleNetwork
path
: allows any length path to an object key you'd like to access. This combines parameter 2 and 3 of simpleSelect
.
"Dino::Name.data", ["Dino::Price", "data"]
defaultValue?
is optional and allows setting of a default value if the requested path is not found.
false, [], {}
[]
in the case of no elements, not undefined
.Allows for multi-key cached selection from Redux state
// OLD
const fields = [
"Name",
"Price",
"Itemized Receipt",
"CheckAlice",
"CheckBob",
"CheckEve",
"CheckMallory",
"CheckTrent",
"Meal",
"Tags"
].map((f: string) => `Dino::${f}`)
const fieldsData = fields
.map((key: string) => {
const value = simpleSelect(props.simpleForm, key, "data")
return { [key]: value }
})
.reduce((prev, current) => ({...prev, ...current}), {})
// New
const fields = [
"Name",
"Price",
"Itemized Receipt",
"CheckAlice",
"CheckBob",
"CheckEve",
"CheckMallory",
"CheckTrent",
"Meal",
"Tags"
].map((f: string) => `Dino::${f}.data`)
const fieldsData = simpleSelectorPick(props.simpleForm, fields)
simpleSelectorPick
subState
: same as parameter 1 for simpleSelect
.
props.simpleForm
, props.simpleNetwork
paths
: array of paths of keys to return from object.
["Dino::Name.data", "Dino::Price.data"]
Dispatched actions can include an options object that has two very powerful keys:
mergeSaga
failureSaga
These are Redux sagas that are run on merge (success) or failure and allow for an additional async block of computation that include other network calls, seeding to many fields parts of the network response data, and anything else.
Both mergeSaga
and failureSaga
follow the same generic Redux Saga API. Consider looking at the src/saga.ts
or src/utilities/mergeSaga.ts
code to find examples of sagas already part of @misk/simpleredux
.
A standardized set of form and input handler Redux-Sagas parts (actions, dispatcher, handlers, sagas, reducers, state interface)
A standardized set of Axios based request Redux-Sagas parts (actions, dispatcher, handlers, sagas, reducers, state interface)
FAQs
Misk-Web SimpleRedux
We found that @misk/simpleredux demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).