
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.
diddi-react
Advanced tools
diddi react bindings
# npm
npm i diddi-react
# yarn
yarn add diddi-react
// ./state-bindings.ts
import createbinding from 'diddi-react';
import state from './state';
export default createbinding(state);
// ./App.tsx
import React from 'react';
import Counter from './components/Counter.tsx';
import { Provider } from './state-bindings';
export default function App() {
return (
<Provider>
<Counter />
</Provider>
)
}
// ./components/Counter.tsx
import React from 'react';
import { useActions, useState } from '../state-bindings';
export default function Counter() {
const actions = useActions();
const state = useState();
return (
<div>
Counter's value: {state.counter.value}
<button onClick={actions.counter.increment}>
Tap to increment
</button>
</div>
);
}
You can use three hooks when you create React bindings with the createbinding function.
This hook returns subscribed actions for each domain. Calling one action will cause your UI to update.
import React from 'react';
import { useActions, useState } from '../state-bindings';
export default function Counter() {
const actions = useActions();
const state = useState();
return (
<div>
Counter's value: {state.counter.value}
<button onClick={actions.counter.increment}>
Tap to increment
</button>
<input
onChange={event => actions.counter.set(Number(event.target.value))}
type="number"
value={state.counter.value}
/>
</div>
);
}
This hook returns current state. (Give a look to the example above).
This hook is similar to redux's one.
import React from 'react';
import { useActions, useSelector } from '../state-bindings';
export default function Counter() {
const actions = useActions();
const value = useSelector(state => state.counter.value);
return (
<div>
Counter's value: {value}
<button onClick={actions.counter.increment}>
Tap to increment
</button>
<input
onChange={event => actions.counter.set(Number(event.target.value))}
type="number"
value={value}
/>
</div>
);
}
To debug states using diddi, you will need this chrome extension (or firefox extension) and it's own middleware.
If you are using multiple middlewares, ensure you put this extension as the latest.
npm i diddi-debug-middleware
import mydomain from './mydomain';
import diddidebugger from 'diddi-debug-middleware';
export default create({ mydomain }, diddidebugger());
Predefined scripts:
Every contribution is really welcome!
If you feel that something can be improved or should be fixed, feel free to open an issue with the feature or the bug found.
If you want to fork and open a pull request (adding features or fixes), feel free to do it. Remember only to use the master branch as a base.
If you plan adding a new feature, please prefix the branch with the feat/branchname.
If you plan fixing something, please prefix the branch with the fix/branchname.
If you plan refactoring something, please prefix the branch with the refactor/branchname.
If you adding something which does not involve the runtime behavious, please prefix the branch with the chore/branchname.
Read the contributing guidelines
Read the licence
FAQs
diddi react bindings
The npm package diddi-react receives a total of 1 weekly downloads. As such, diddi-react popularity was classified as not popular.
We found that diddi-react 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
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.