Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/react-hooks

Package Overview
Dependencies
Maintainers
13
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/react-hooks - npm Package Compare versions

Comparing version 1.2.5 to 1.3.0

dist/hooks/previous.d.ts

2

CHANGELOG.md

@@ -10,2 +10,4 @@ # Changelog

- Added a `usePrevious` hook ([#1145](https://github.com/Shopify/quilt/pull/1145))
## [1.2.0] - 2019-04-25

@@ -12,0 +14,0 @@

@@ -5,1 +5,2 @@ export { useLazyRef } from './lazy-ref';

export { useMountedRef } from './mounted-ref';
export { default as usePrevious } from './previous';

@@ -11,1 +11,3 @@ "use strict";

exports.useMountedRef = mounted_ref_1.useMountedRef;
var previous_1 = require("./previous");
exports.usePrevious = previous_1.default;

2

package.json
{
"name": "@shopify/react-hooks",
"version": "1.2.5",
"version": "1.3.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "A collection of primitive React hooks.",

@@ -87,1 +87,19 @@ # `@shopify/react-hooks`

```
### `usePrevious()`
This hook will store the previous value of a given variable.
```tsx
function Score({value}) {
const previousValue = usePrevious(value);
const newRecord = value > previousValue ? <p>We have a new record!</p> : null;
return (
<>
<p>Current score: {value}</p>
{newRecord}
</>
);
}
```
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