Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
preactive
Advanced tools
Readme
A R&D project to evaluate an alternative API for developing components
with Preact using an alternative to hook functions (called "extensions").
The main advantages of the new API are:
Be aware that this project is just for research purposes and is not meant to be used in production.
git clone https://github.com/js-works/preactive.git
cd preactive
npm install
npm run storybook
import { h, render } from 'preact';
import { component, preset } from 'preactive';
import { stateVal } from 'preactive/ext';
const Counter = component('Counter')<{
initialCount?: number;
label?: string;
}>((props) => {
preset(props, () => ({
initialCount: 0,
label: 'Counter'
}));
const [getCount, setCount] = stateVal(props.initialCount);
const onIncrement = () => setCount((it) => it + 1);
return () => (
<div>
<label>{props.label}: </label>
<button onClick={onIncrement}>{getCount()}</button>
</div>
);
});
render(<Counter />, document.getElementById('app'));
import { h, render } from 'preact';
import { component, preset } from 'preactive';
import { effect, stateObj } from 'preactive/ext';
const Counter = component('Counter')<{
initialCount?: number;
label?: string;
}>((props) => {
preset(props, () => ({
initialCount: 0,
label: 'Counter'
}));
const [state, set] = stateObj({
count: props.initialCount
});
const onIncrement = () => set.count((it) => it + 1);
effect(
() => console.log(`Value of "${props.label}": ${state.count}`),
() => [state.count]
);
return () => (
<div>
<label>{props.label}: </label>
<button onClick={onIncrement}>{state.count}</button>
</div>
);
});
render(<Counter />, document.getElementById('app'));
component(displayName, render: props => vnode): ComponentClass
component(displayName, init: props => () => vnode): ComponentClass
component(displayName): (render: props => vnode) => ComponentClass
component(displayName): (init: props => () => vnode) => ComponentClass
preset(props, defaultProps or getDefaultProps)
stateVal(initialValue)
stateObj(initialValues)
createMemo(calculation, getDependencies)
consume(context)
effect(action, getDependencies? | null)
interval(action, milliseconds)
handlePromise(getPromise)
This R&D project is in a very early development state
FAQs
A R&D project to evaluate an alternative API for developing components with Preact using an alternative to hook functions (called "extensions"). The main advantages of the new API are:
The npm package preactive receives a total of 3 weekly downloads. As such, preactive popularity was classified as not popular.
We found that preactive demonstrated a not healthy version release cadence and project activity because the last version was released 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
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.