Skip to content

Instantly share code, notes, and snippets.

View SirSerje's full-sized avatar
🏠
Working from home

Serhii Viazkov SirSerje

🏠
Working from home
View GitHub Profile
@SirSerje
SirSerje / withStorage.js
Created January 22, 2019 07:45 — forked from treyhuffine/withStorage.js
A higher-order component to access localStorage
import React from 'react';
const withStorage = (WrappedComponent) => {
class HOC extends React.Component {
state = {
localStorageAvailable: false,
};
componentDidMount() {
this.checkLocalStorageExists();