Skip to content

Instantly share code, notes, and snippets.

View sami616's full-sized avatar
⚛️
Probably fixing some typing issue

Sami Resua sami616

⚛️
Probably fixing some typing issue
View GitHub Profile
{
"A Component": {
"prefix": [
"component",
],
"body": [
"import React from 'react'",
"import styled, { css } from 'styled-components'",
"",
"//x//////////////////////////////////////////////////",
@sami616
sami616 / cloudSettings
Last active December 28, 2019 08:36
VSCode settings
{"lastUpload":"2019-12-28T08:36:28.013Z","extensionVersion":"v3.4.3"}
@sami616
sami616 / component.js
Last active April 25, 2019 13:07
Medium post component.js
import React from 'react'
import { Counter } from '../store'
const SomeComponent = () => {
const counterState = React.useContext(Counter.State)
const counterDispatch = React.useContext(Counter.Dispatch)
return (
<>
<p>Count: {counterState.number}</p>
@sami616
sami616 / index.js
Created April 25, 2019 13:02
Medium post index.js
import React from 'react'
import ReactDOM from 'react-dom'
import { Store } from './store'
const App = () => (
<Store>
//...
</Store>
)
@sami616
sami616 / store.js
Last active April 25, 2019 12:54
Medium post store.js
import React from 'react'
import { Counter } from './counter'
const providers = [<Counter.Provider />]
const Store = ({ children: initial }) =>
providers.reduce(
(children, parent) => React.cloneElement(parent, { children }),
initial
)
@sami616
sami616 / counter.js
Created April 25, 2019 12:50
Medium global state gist
import React from 'react'
// Context
const State = React.createContext()
const Dispatch = React.createContext()
// Reducer
const reducer = (state, action) => {
switch (action.type) {
case 'increment':
@sami616
sami616 / Dracula.itermcolors
Last active August 22, 2017 09:33
Terminal PS1
<?xml version="1.0" encoding="UTF-8"?>
<!-- Dracula Theme v1.2.5
#
# https://github.com/dracula/iterm
#
# Copyright 2013-present, All rights reserved
#
# Code licensed under the MIT license
#