@preact/signals-react 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @preact/signals-react
2
2
 
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#535](https://github.com/preactjs/signals/pull/535) [`58befba`](https://github.com/preactjs/signals/commit/58befba577d02c5cac5292fda0a599f9708e908b) Thanks [@jviide](https://github.com/jviide)! - Publish packages with provenance statements
8
+
9
+ - Updated dependencies [[`d846def`](https://github.com/preactjs/signals/commit/d846defaf6e64f0236e2b91247e5f94a35f29cbc), [`cb6bdab`](https://github.com/preactjs/signals/commit/cb6bdabbd31b27f8435c7976089fa276da6bfb7a), [`d846def`](https://github.com/preactjs/signals/commit/d846defaf6e64f0236e2b91247e5f94a35f29cbc), [`d846def`](https://github.com/preactjs/signals/commit/d846defaf6e64f0236e2b91247e5f94a35f29cbc), [`d846def`](https://github.com/preactjs/signals/commit/d846defaf6e64f0236e2b91247e5f94a35f29cbc)]:
10
+ - @preact/signals-core@1.6.0
11
+
3
12
  ## 2.0.0
4
13
 
5
14
  ### Major Changes
package/README.md CHANGED
@@ -58,14 +58,14 @@ function CounterValue() {
58
58
  }
59
59
  ```
60
60
 
61
- See the [Readme for the Babel plugin](../babel-plugin-signals-react/README.md) for more details about how the transform works and configuring it.
61
+ See the [Readme for the Babel plugin](../react-transform/README.md) for more details about how the transform works and configuring it.
62
62
 
63
63
  ### `useSignals` hook
64
64
 
65
65
  If you can't use the Babel transform, you can directly call the `useSignals` hook to make your components reactive.
66
66
 
67
67
  ```js
68
- import { useSignals } from "@preact/signals-react";
68
+ import { useSignals } from "@preact/signals-react/runtime";
69
69
 
70
70
  const count = signal(0);
71
71
 
@@ -77,15 +77,19 @@ function CounterValue() {
77
77
 
78
78
  ### Hooks
79
79
 
80
- If you need to instantiate new signals inside your components, you can use the `useSignal` or `useComputed` hook.
80
+ If you need to instantiate new signals or create new side effects on signal changes inside your components, you can use the `useSignal`, `useComputed` and `useSignalEffect` hooks.
81
81
 
82
82
  ```js
83
- import { useSignal, useComputed } from "@preact/signals-react";
83
+ import { useSignal, useComputed, useSignalEffect } from "@preact/signals-react";
84
84
 
85
85
  function Counter() {
86
86
  const count = useSignal(0);
87
87
  const double = useComputed(() => count.value * 2);
88
88
 
89
+ useSignalEffect(() => {
90
+ console.log(`Value: ${count.value}, value x 2 = ${double.value}`);
91
+ });
92
+
89
93
  return (
90
94
  <button onClick={() => count.value++}>
91
95
  Value: {count.value}, value x 2 = {double.value}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preact/signals-react",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "license": "MIT",
5
5
  "description": "Manage state with style in React",
6
6
  "keywords": [],
@@ -61,7 +61,7 @@
61
61
  "README.md"
62
62
  ],
63
63
  "dependencies": {
64
- "@preact/signals-core": "^1.5.1",
64
+ "@preact/signals-core": "^1.6.0",
65
65
  "use-sync-external-store": "^1.2.0"
66
66
  },
67
67
  "peerDependencies": {
@@ -75,5 +75,8 @@
75
75
  "react-dom": "^18.2.0",
76
76
  "react-router-dom": "^6.9.0"
77
77
  },
78
+ "publishConfig": {
79
+ "provenance": true
80
+ },
78
81
  "scripts": {}
79
82
  }