
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
deku-stateful
Advanced tools
Keep state in Deku components
Deku v2 has no states in components. This is a higher-order component that adds state and setState to the model.
See this conversation here.
Compatible with Deku 2.0.0 (tested with 2.0.0-rc11) and Decca 2.0.0.
import stateful from 'deku-stateful'
function initialState () {
return { clicked: 0 }
}
function render ({ getState, setState }) {
return <div>
Clicked { getState().clicked } times.
<button onClick={ () => setState({ clicked: getState().clicked + 1 }) }>
Click me
</button>
</div>
}
export default stateful({ initialState, render })
The render function and the lifecycle hooks will also be passed getState and setState.
function render({ getState, setState }) {
}
setState(object) — Updates the state when called. When setState is ran, it will queue up changes and dispatch an event like dispatch({ type: 'UI_STATE_CHANGE' }). This is meant to be picked up by your Redux store, which we're assuming will retrigger a render() when called.getState() — Returns the current state.state — The current state; it's preferred to use getState() instead, but it's here for legacy compatibility.Your component can have an initialState function. Return the first state here.
function initialState ({ props }) {
return { clicked: false }
}
export default stateful({ initialState, render })
deku-stateful © 2016+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).
ricostacruz.com · GitHub @rstacruz · Twitter @rstacruz
[v1.7.0]
Sep 20, 2016
getState(). (Related: [#4], [@11111000000])FAQs
Keep states in a Deku component
The npm package deku-stateful receives a total of 6 weekly downloads. As such, deku-stateful popularity was classified as not popular.
We found that deku-stateful demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.