This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"A Component": { | |
"prefix": [ | |
"component", | |
], | |
"body": [ | |
"import React from 'react'", | |
"import styled, { css } from 'styled-components'", | |
"", | |
"//x//////////////////////////////////////////////////", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2019-12-28T08:36:28.013Z","extensionVersion":"v3.4.3"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import ReactDOM from 'react-dom' | |
import { Store } from './store' | |
const App = () => ( | |
<Store> | |
//... | |
</Store> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
// Context | |
const State = React.createContext() | |
const Dispatch = React.createContext() | |
// Reducer | |
const reducer = (state, action) => { | |
switch (action.type) { | |
case 'increment': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
# |