Skip to content

Instantly share code, notes, and snippets.

View RyanOliveira00's full-sized avatar

Ryan Oliveira RyanOliveira00

View GitHub Profile
@RyanOliveira00
RyanOliveira00 / Compose.tsx
Created April 12, 2023 21:41
Compose to group contexts in React
import React from 'react';
interface ComposeProps {
components: Array<React.JSXElementConstructor<React.PropsWithChildren<any>>>;
children: React.ReactNode;
}
export const Compose = (props: ComposeProps) => {
const { components = [], children, ...rest } = props;
@RyanOliveira00
RyanOliveira00 / install-docker.md
Created January 17, 2023 18:33 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
{
"emmet.syntaxProfiles": {
"javascript": "jsx"
},
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 16,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [80, 120],
"extensions.ignoreRecommendations": true,
import { useState, useEffect, Dispatch, SetStateAction } from "react";
type Response<T> = [T, Dispatch<SetStateAction<T>>];
export function usePersistentState<T>(
key: string,
initialState: T
): Response<T> {
const [state, setState] = useState(() => {
const storageValue = localStorage.getItem(key);