Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Reusable is a library for reusing state and business logic between components.
Reusable is a library for reusing state and business logic between components.
This is a very early stage alpha If you want to start experimenting with it and share feedback - yes If you need it for a production app - no
Reusable solves the problems that state management is meant for, with a simple and clean API, inspired and based on React hooks API.
React hooks introduced new ways of thinking about state and side-effects. These new ways made old habits obsolete, and require a new type of state management tool that embraces the same concepts:
While still providing the developers with structure and architecture with large-scale apps in mind.
// reusables/counter.js
import { reuseState } from "reusable";
export const counter = () => reuseState(0);
// App.js:
import { ReuseProvider } from "reusable/react";
const App = () => (
<ReuseProvider>
...
</ReuseProvider>
);
// component #1:
import { useReusable } from "reusable/react";
import { counter } from "./reusables/counter";
const CompOne = () => {
const [counter, setCounter] = useReusable(counter);
return ...
}
// component #2:
import { useReusable } from "reusable/react";
import { counter } from "./reusables/counter";
const CompTwo = () => {
const [counter, setCounter] = useReusable(counter); // Yup, same counter
return ...
}
// reusables/counterState.js:
import { reuseState } from "reusable";
export const counterState = () => {
const [counter, setCounter] = reuseState(0);
const [step, setStep] = reuseState(0);
return {
counter,
step,
setStep,
increment: () => setCounter(val => val + step),
decrement: () => setCounter(val => val - step)
}
}
// component:
import { useReusable } from "reusable/react";
import { counterState } from './reusables/counterState';
const Comp = () => {
const counterState = useReusable(counterState);
return ... // Just use it!
}
// TBD
// TBD
// TBD
// TBD
// TBD
The answer is pretty much the same for people asking about "Redux vs. Context API?" Using Context API directly gives a simple API to share state between components, but it doesn't provide other benefits that reuse provides, such as:
Reuse is built with large-scale apps in mind. This is what affected most of the considerations when designing the solution:
https://goo.gl/forms/Jza0XsM7F3shvWhD2
FAQs
Reusable is a library for state management using React hooks
We found that reusable demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.