
Security News
arXiv Is Rate Limiting Authors Following a Flood of AI Slop Submissions
arXiv now limits authors to two submissions a month as AI slop overwhelms moderators, delays good papers, and sparks debate over applying the limit to everyone.
react-shared-state
Advanced tools
Very simple shared store for your react app.
Important! 0.2 has changed connect's behavior.
store instead of store.state as first argumentconnect no longer passes store by it's name to a componentYourProvider.connect instead of building custom functionimport React, { Component } from "react";
import ReactDOM from "react-dom";
import { createProvider, SharedStore } from "react-shared-state";
class GithubIssuesStore extends SharedStore {
state = {
loading: false,
issuesCount: 0
};
loadCountFromGithub = () => {
this.setState({ loading: true });
fetch("https://api.github.com/repos/vmg/redcarpet/issues?state=closed")
.then(resp => resp.json())
.then(data => {
this.setState({
issuesCount: data.length,
loading: false
});
});
};
resetCount = () => this.setState({ issuesCount: 0 });
incrementCount = () => this.setState({ issuesCount: this.state.issuesCount += 1 });
}
const GithubProvider = createProvider("github", GithubIssuesStore);
@GithubProvider.connect((store, props) => ({
issuesCount: store.state.issuesCount,
loading: store.state.loading
}))
class IssuesCount extends React.Component {
render = () => {
const { issuesCount, loading } = this.props;
return <h1>Issues count: {loading ? "..." : issuesCount}</h1>;
};
}
// We can use compose as a HOC call
const ControlButtonsComponent = props => (
<div>
<button onClick={() => props.loadCountFromGithub()}>
Load From GitHub
</button>
<button onClick={() => props.resetCount()}>Reset</button>
<button onClick={() => props.incrementCount()}>Increment</button>
</div>
);
const ControlButtons = GithubProvider.connect(store => ({
loadCountFromGithub: store.loadCountFromGithub,
resetCount: store.resetCount,
incrementCount: store.incrementCount
}))(ControlButtonsComponent);
export class App extends Component {
render() {
return (
<div>
<GithubProvider initialState={{ issuesCount: 0 }}>
<IssuesCount />
<ControlButtons />
</GithubProvider>
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById("root"));

You can add logging for all stores
import { ProviderComponent} from 'react-shared-state'
ProviderComponent.DEBUG = true
or individually
<SimpleProvider ... debug={true}>
...
</SimpleProvider>
FAQs

Security News
arXiv now limits authors to two submissions a month as AI slop overwhelms moderators, delays good papers, and sparks debate over applying the limit to everyone.

Research
/Security News
A new GhostAction wave hits hundreds of GitHub repos, expanding CI/CD secret theft to cloud and AI credentials in source code and git history.

Research
/Security News
Tensorlake npm SDK version 0.5.144 was compromised in a ChainDrop / Shai-Hulud attack, delivering credential-stealing malware.