Skip to content

Instantly share code, notes, and snippets.

@Paratron
Paratron / storageHooks.js
Created February 14, 2019 12:24
Enables you to use hooks for localStorage and sessionStorage that even redraw all components when their respective values change.
import React from "react";
let lsBus = {};
let ssBus = {};
/**
* Redraw all components that have a hook to localStorage with the given key.
* @param {string} key
* @param {*} newValue
*/
@rikukissa
rikukissa / POST.md
Last active July 11, 2025 00:14
React Hook prompting the user to "Add to homescreen" 🏠 #PWA #React
title slug createdAt language preview
React Hook prompting the user to "Add to homescreen"
react-hook-prompting-the-user-to-add
2018-11-29T20:35:02Z
en
Simple React Hook for showing the user a custom "Add to homescreen" prompt.

React Hook for showing custom "Add to homescreen" prompt

let UserContext = React.createContext();
class App extends React.Component {
state = {
user: null,
setUser: user => {
this.setState({ user });
}
};
@rafael-neri
rafael-neri / install_ionic_yarn.sh
Last active April 10, 2021 09:32
Install Ionic Using Yarn on Ubuntu
# Install Node
sudo apt-get install nodejs
# Link command node
sudo ln -s /usr/bin/nodejs /usr/bin/node
# Install CURL
sudo apt-get install curl