Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@nanostores/solid
Advanced tools
Solid integration for Nano Stores, a tiny state manager with many atomic tree-shakable stores.
Solid integration for Nano Stores, a tiny state manager with many atomic tree-shakable stores.
Install it:
pnpm add nanostores @nanostores/solid # or npm or yarn
Use it:
// store.ts
import { action, atom, computed } from 'nanostores';
export const bearStore = atom({ value: 0 });
export const increase = action(bearStore, 'increase', (store) => {
store.set({ value: store.get().value + 1 });
});
// Use computed stores to create chains of reactive computations.
export const doubled = computed(bearStore, current =>
current.count * 2,
);
import { useStore } from '@nanostores/solid';
import { bearStore, increase } from './store';
function BearCounter() {
const count = useStore(bearStore);
return <h1>{count().value} around here ...</h1>;
}
function Controls() {
return <button onClick={increase}>one up</button>;
}
Nano Stores support SSR. Use standard strategies.
import { isServer } from 'solid-js/web';
if (isServer) {
settings.set(initialSettings);
router.open(renderingPageURL);
}
You can wait for async operations (for instance, data loading via isomorphic fetch()
) before rendering the page:
import { renderToString } from 'solid-js/web';
import { allTasks } from 'nanostores';
post.listen(() => {}); // Move store to active mode to start data loading
await allTasks();
const html = renderToString(<App />);
@nanostores/router
import { createRouter } from '@nanostores/router';
import { useStore } from '@nanostores/solid';
import { Match, Suspense, Switch, lazy } from 'solid-js';
export const routerStore = createRouter({
home: '/',
post: '/posts/:postId',
comment: '/posts/:postId/comments/:commentId',
});
const Home = lazy(() => import('./pages/Home'));
const Post = lazy(() => import('./pages/Post'));
const Comment = lazy(() => import('./pages/Comment'));
const NotFound = lazy(() => import('./pages/NotFound'));
export const Router = () => {
const page = useStore(routerStore);
return (
<Switch fallback={<NotFound />}>
<Match when={page().route === 'home'}>
<Home />
</Match>
<Match when={page().route === 'post'}>
<Post postId={page().params.postId} />
</Match>
<Match when={page().route === 'comment'}>
<Comment postId={page().params.postId} commentId={page().params.commentId} />
</Match>
</Switch>
);
};
MIT
FAQs
Solid integration for Nano Stores, a tiny state manager with many atomic tree-shakable stores.
The npm package @nanostores/solid receives a total of 1,909 weekly downloads. As such, @nanostores/solid popularity was classified as popular.
We found that @nanostores/solid demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.