@timesinternet/times-storage
v0.0.0
Published
this package will be used to store data at client end
Downloads
1
Readme
times-storage
A React component to save and retrive data in local storage, session storage and cookie
Installation
Browser
npm install --save times-storage
Browser
import storage from 'times-storage';
export class MyComponent extends Component {
set(){
storage.set("key","value","session");
}
get(){
storage.get("key","session");
}
remove(){
storage.remove("key","session");
}
render(){
return(
<div>
<button onClick={this.set.bind(this)}>Set</button>
<button onClick={this.get.bind(this)}>Get</button>
<button onClick={this.remove.bind(this)}>Delete</button>
</div>
)
}
}
export default MyComponent;
Available functions
- set: set value or object in storage (storage options are 'cookie','session','local')
- get: get value from storage
- remove: delete value from storage
License
N/A