
Security News
/Research
Fake Corepack Site Distributes Infostealer and Proxyware to Developers
A fake corepack.org site is impersonating the Node.js tool and delivers an infostealer and proxyware to developers who download it.
react-reactivity
Advanced tools
仅仅需要一个 store 文件,你就可以开始编写你的数据仓库。
本库只提供 Provider 和 useStore 两个 api,配合 @vue/reactivity 仓库里的响应式能力,即可完成一切状态管理。
// yarn
yarn add react-reactivity @vue/reactivity -S
// npm
npm install react-reactivity @vue/reactivity -S
// store.js
import {reactive, effect, computed} from '@vue/reactivity'
export const state = reactive({
count: 0,
message: 'Hello',
msgList: []
})
const plusOne = computed(() => state.count + 1);
const plusOneSquare = computed(() => plusOne.value * plusOne.value)
const add = () => state.count += 1
const setMsg = message => (state.message = message)
const sendMsg = msg => (state.msgList = [...state.msgList, msg])
const delMsg1 = index => {
const newMsg = JSON.parse(JSON.stringify(state.msgList))
newMsg.splice(index, 1)
state.msgList = newMsg
}
const delMsg2 = index => state.msgList.splice(index, 1)
effect(() => {
console.log('plusOne', plusOne)
})
export const mutations = {
add,
setMsg,
sendMsg,
delMsg1,
delMsg2
}
export const store = {
state,
computed: {
plusOne,
plusOneSquare
}
}
// index.js
import React from 'react';
import {Card, Button, Input} from 'antd';
import {Provider, useStore} from '../../src';
import {store, mutations} from './store';
import './index.css';
import 'antd/dist/antd.css';
function Count() {
const countState = useStore((store) => {
const {state, computed} = store
const {plusOne, plusOneSquare} = computed
return {
count: state.count,
plusOne,
plusOneSquare
}
});
return (
<Card hoverable style={{marginBottom: 24}}>
<h1>计数器</h1>
<div className="chunk">
<div className="text-chunk">count: {countState.count}</div>
<div className="text-chunk">count加一: {countState.plusOne}</div>
<div className="text-chunk">count加一后平方: {countState.plusOneSquare}</div>
<Button onClick={mutations.add}>add</Button>
</div>
</Card>
);
}
function Chat() {
const message = useStore((store) => store.state.message)
const _handleSend = msg => {
mutations.setMsg('')
mutations.sendMsg(msg)
}
return (
<Card hoverable style={{marginBottom: 24}}>
<h1>聊天室</h1>
<div className="text-chunk">当前消息是: {message}</div>
<Input.Search
placeholder="请输入消息"
enterButton="Send"
size="large"
value={message}
onChange={v => mutations.setMsg(v.target.value)}
onSearch={(msg) => _handleSend(msg)}
/>
</Card>
);
}
// function ViewArea() {
// const msgList = useStore(store => store.state.msgList)
//
// return (
// <Card hoverable style={{marginBottom: 24}}>
// <h1>消息列表</h1>
// {msgList.map((msg, i) => <div onClick={() => mutations.delMsg1(i)} key={i}>{msg}</div>)}
// </Card>
// )
// }
function ViewArea() {
const msgList = useStore((store) => {
return store.state.msgList.map((msg, i) => (
<div onClick={() => mutations.delMsg2(i)} key={i}>
{msg}
</div>
));
});
return (
<Card hoverable style={{marginBottom: 24}}>
<h1>消息列表</h1>
{msgList}
</Card>
)
}
export default () => {
return (
<Provider value={store}>
<div className="flex">
<Count/>
<Chat/>
<ViewArea/>
</div>
</Provider>
);
};
FAQs
Use Vue3 Composition Api in React, just import @vue/reactivity
The npm package react-reactivity receives a total of 5 weekly downloads. As such, react-reactivity popularity was classified as not popular.
We found that react-reactivity demonstrated a not healthy version release cadence and project activity because the last version was released 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
/Research
A fake corepack.org site is impersonating the Node.js tool and delivers an infostealer and proxyware to developers who download it.

Research
/Security News
A large-scale campaign abused GitHub Actions in compromised repositories to exploit CVE-2026-41940 in cPanel and WHM and steal server credentials.

Security News
Five frontier LLMs generated the same nonexistent package names, leaving 53 available for potential slopsquatting across PyPI and npm.