
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
domein-react
Advanced tools
domein react bindings
# npm
npm i domein-react
# yarn
yarn add domein-react
// ./state-bindings.ts
import createbinding from 'domein-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 domein, 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 domein-debug-middleware
import mydomain from './mydomain';
import domeindebugger from 'domein-debug-middleware';
export default create({ mydomain }, domeindebugger());
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
domein react bindings
We found that domein-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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.