
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@slimr/react
Advanced tools
A collection of useful 1st and third party react components, hooks, and util. Includes several other @slimr libs for convenience
A collection of useful 1st and third party react components, hooks, and util. Includes several other @slimr libs for convenience
@slimr is a set of slim React (hence '@slimr') libs. Check them all out on github!
npm i, yarn i, ...etc)vite.config.jsexport default defineConfig({
test: {
deps: {
inline: ['@slimr/hooks'],
},
},
})
Merge React refs so that multiple refs can be used on a single element. Is used to merge refs from a forwardRef and a local ref from useRef.
Credits: react-merge-refs
const MyComponent = forwardRef((props, ref1) => {
const ref2 = useRef(null)
return (<div ref={mergeRefs([ref1, ref2])} />)
})
Provides a variable with observable capabilities, like pub/sub and React hook integration.
import { Observable } from '@slimr/react';
const myObservable = new Observable('myObservable', 0);
myObservable.subscribe((newValue) => { console.log('New value:', newValue); });
setTimeout(() => { myObservable.val = 42; }, 1000);
setTimeout(() => { myObservable.set(50); }, 2000);
setTimeout(() => { myObservable.set(last => last + 1); }, 3000);
function MyComponent() {
myObservable.use();
return <div>{myObservable.value}</div>;
}
like react-use's useDeepEffects, but for memos
Returns a set-like object that intercepts the setter function to trigger re-renders on change. Also adds a toggle and reset method. @slimr/hooks also exports a useSet from react-use, which is similar but has a different, less desirable (imho) pattern.
function MyComponent() {
const optionalInitialValue = new Set()
const [set1, set1Setters] = useSet(optionalInitialValue)
const set2 = useSet2(optionalInitialValue)
// Use set2 like you would a vanilla JS Set
A hook that accepts a function callback, calls the function and returns a reactive callback state. Uses a cache and will return the cache value if available while waiting for the callback to complete, then update the return on complete. This is often called 'stale-while-refresh' and abbreviated as 'SWR', hence the name of the hook. Source is in @slimr/swr
import {useSWR} from `@slimr/swr`
function MyComponent({ page }: number) {
const { result, loading, refresh} = useSWR(() => getPageData(page), [page], {throttle: Infinity})
if (loading) return null
return (
<section>
<h1>{result.title}</h1>
<p>{result.description}</h1>
<button onClick={refresh}>Refresh</button>
</section>
)
}
FAQs
A collection of useful 1st and third party react components, hooks, and util. Includes several other @slimr libs for convenience
We found that @slimr/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.