Popularity
0.2
Stable
Activity
8.1
Stable
1
1
0

Programming language: JavaScript
Tags: Code Design     Data Store    
Latest version: v0.2.0

react-storage-hoc alternatives and similar libraries

Based on the "Data Store" category.
Alternatively, view react-storage-hoc alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of react-storage-hoc or a related project?

Add another 'Data Store' Library

README

react-storage-hoc

Local and session storage higher-order component for React.

Installation

Via npm:

npm i --save react-storage-hoc

Via yarn:

yarn add react-storage-hoc

Basic Example

import React from 'react';
import { withLocalStorage } from 'react-storage-hoc';

class App extends React.Component {
  render() {
    const { localStorage } = this.props;
    const count = localStorage.count || 0;
    const incCount = () => (localStorage.count = 1 + count);
    const resetCount = () => delete localStorage.count;

    return (
      <div>
        <p>{count}</p>
        <button onClick={incCount}>inc</button>
        <button onClick={resetCount}>reset</button>
      </div>
    );
  }
}

export default withLocalStorage(App);

Examples

These interactive CodeSandbox examples showcase how to use react-storage-hoc.


*Note that all licence references and agreements mentioned in the react-storage-hoc README section above are relevant to that project's source code only.