Preact Signals: Supercharge your React/Preact development! Unleash the power of reactive programming with hooks, components, a TanStack query adapter, and more. Code smarter, not harder
MIT License
Bot releases are visible (Hide)
Published by github-actions[bot] 10 months ago
75d8a9f: # Breaking Changes
This release changes opt-in and opt-out directives to be the same as in @preact/signals-react
.
@trackSignals
-> @useSignals
@noTrackSignals
-> @noUseSignals
To support new directives, you can just find and replace all instances of the old directives with the new ones.
Published by github-actions[bot] 10 months ago
reactifyLite
with regular propsPublished by github-actions[bot] 10 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
rafReaction
fn after disposalPublished by github-actions[bot] 11 months ago
a1628ba: Added manual tracking option with HOC withTrackSignals
for unsupported environments.
import { withTrackSignals } from "@preact-signals/safe-react/manual";
const A = withTrackSignals(() => {
const count = signal(0);
count.value++;
return <div>{count.value}</div>;
});
d5fc3f0: Removed incorrect jsx exports importSource @preact-signals/safe-react
-> @preact-signals/safe-react/jsx
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
d3bbcd3: Added WritableUncached which receives getter and setter functions.
const a = signal({ a: 1 });
const aField = $w({
get() {
return a().a;
},
set(value) {
a({ a: value });
},
});
console.log(aField.value); // 1
aField.value = 2;
console.log(aField.value); // 2
console.log(a.value); // { a: 2 }
8ad6ae2: Added rafReaction
for easier integration with raw DOM.
rafReaction
Will execute reaction after deps changed on next animation frame. Return dispose function.
const sig = signal(1);
const el = document.createElement("div");
rafReaction(
// deps
() => sig.value,
// effect
(value) => {
el.style.transform = `translateX(${value}px)`;
},
);
sig.value = 10;
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
eb2df1b: Moved deepReactivity api to main entry point
@preact-signals/utils/store
is now @preact-signals/utils
@preact-signals/utils/store/hooks
is now @preact-signals/utils/hooks
For now the old paths are still available, but will be removed in the next minor version.
Published by github-actions[bot] 11 months ago
useSignals
- batching it to one queueMicrotask
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
5a2abc9: Fix of jsxImportSource
while @babel/plugin-transform-react-jsx
is trying to use main entry of jsx runtime instead of jsx-runtime
package.
Changed jsxImportSource
to satisfy this requirement.
// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { createReactAlias } from "@preact-signals/safe-react/integrations/vite";
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
// add react alias
alias: [createReactAlias()],
},
plugins: [
react({
// using custom wrapper for jsx runtime and babel plugin for components
// Previously: jsxImportSource: "@preact-signals/safe-react",
jsxImportSource: "@preact-signals/safe-react/jsx",
babel: {
plugins: ["module:@preact-signals/safe-react/babel"],
},
}),
],
});
For now old style are also working but will be dropped in next minor
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
"moduleResolution": "node"
Published by github-actions[bot] 11 months ago
"moduleResolution": "node"
Published by github-actions[bot] 11 months ago