Security News
The Dark Side of Open Source
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.
react-client-session
Advanced tools
Readme
A simple object to manage client session data in a React app. This is not synchronized with server side sessions.
npm install react-client-session --save
A simple example. Download and run the demo for more examples, or browse the examples here.
username
.Supported storage types are memory
(default), cookie
, localStorage
and sessionStorage
.
NOTE: When using cookie
store type, all key value pairs that are set via ReactSession.set(key, value);
are serialized as JSON in to one single cookie called __react_session_<DOMAIN>
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import { ReactSession } from 'react-client-session';
function App() {
ReactSession.setStoreType("localStorage");
ReactSession.set("username", "Bob");
return (
<div>
<Switch>
// Routes
</Switch>
</div>
);
}
export default App;
username
from somewhere else in your App.import React from 'react';
import { ReactSession } from 'react-client-session';
function MyComponent() {
const username = ReactSession.get("username");
return (
<p>User Name is: {username}</p>
)
}
export default Simple;
git clone https://github.com/grizzthedj/react-session.git
cd react-session
npm install
gulp demo
Browse http://localhost:8080
FAQs
A simple object to manage a client session in a React app
The npm package react-client-session receives a total of 1,072 weekly downloads. As such, react-client-session popularity was classified as popular.
We found that react-client-session 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
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.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.