New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

compose-state

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compose-state - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

2

package.json

@@ -13,3 +13,3 @@ {

},
"version": "1.0.5",
"version": "1.0.6",
"description": "Compose multiple setState or getDerivedStateFromProps updaters in React",

@@ -16,0 +16,0 @@ "main": "dist.js",

# ✍️ compose-state
`compose-state` is a library to compose multiple `setState` or `getDerivedStateFromProps` updaters in React.
`compose-state` is a library to compose multiple state updaters in React.
`compose-state` accepts any valid updaters – objects or functions – and executes them in the standard compositional right-to-left order.
<img width="488" src="https://user-images.githubusercontent.com/4934193/39415633-8ed13b02-4bfa-11e8-9e0e-b706ae68fdbc.png" alt="example" />
# Install
`compose-state` works with the standard `setState` parameters – objects or functions – so you don’t have to learn any new syntax. It’s also compatible with React’s new [`getDerivedStateFromProps`](https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops) lifecycle method.
`yarn add compose-state`
# Use
`npm install --save compose-state`
`yarn add compose-state` or `npm install compose-state`
# Use
```jsx

@@ -95,3 +91,3 @@ import composeState from 'compose-state';

`compose-state` comes with a `composeDerivedStateFromProps` function to use with React's new [getDerivedStateFromProps](https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops) lifecycle method.
`compose-state` comes with a `composeDerivedStateFromProps` function to use with React's new [`getDerivedStateFromProps`](https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops) lifecycle method.

@@ -114,2 +110,8 @@ ```jsx

## It's just normal, [boring](https://twitter.com/jevakallio/status/987062864002342912) React
While more formal state managers push developers away from controlling state in React, `compose-state` simply enhances state control methods that are primitive to the platform.
`compose-state` is a lot like [Classnames](https://github.com/JedWatson/classnames). It's a helper function that makes `setState` calls more declarative and easier to construct, just like how Classnames is a helper function that makes `className` values more declarative and easier to construct.
# Further reading

@@ -116,0 +118,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc