This file contains hidden or 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 * as React from 'react' | |
interface Props { | |
onSubmit: (account: string, password: string) => any | |
} | |
interface State { | |
account: string | |
password: string | |
} |
This file contains hidden or 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
function persist(instanceProperty, storageKey) { | |
return { | |
created() { | |
const name = this.$options.name || 'Persistence' | |
storageKey = storageKey || `__persist__${name}__${instanceProperty}` | |
this.$watch(instanceProperty, { | |
deep: true, | |
handler(value) { | |
localStorage.setItem(storageKey, JSON.stringify(value)) |
This file contains hidden or 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
router.get(':/category', async (req, res) => { | |
try { | |
const category = await Category.findOne({ /* ... */ }) | |
const posts = await Post.findAll({ /* ... */ }) | |
res.render(/* ... */) | |
} catch (err) { | |
console.error(err) | |
} | |
}) |
This file contains hidden or 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 { render } from 'react-dom' | |
import styled, { css } from 'styled-components' | |
const centerContent = css` | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
` |
This file contains hidden or 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 Yup from 'yup' | |
import { withFormik, FormikProps, FormikErrors } from 'formik' | |
interface FormValues { | |
email: string | |
password: string | |
} | |
const InnerForm = (props: FormikProps<FormValues>) => ( |
This file contains hidden or 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
const Button = styled.button` | |
border: 1px solid black; | |
${props => props.primary && primaryStyle}; | |
${props => props.danger && dangerStyle}; | |
${props => props.warning && warningStyle}; | |
` | |
const primaryStyle = css` | |
color: white; | |
background: blue; |
This file contains hidden or 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 * as React from 'react' | |
class Fetcher extends React.Component { | |
constructor() { | |
this.state = { | |
loading: true, | |
data: {}, | |
} | |
} |
This file contains hidden or 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
"use strict"; | |
var __values = (this && this.__values) || function (o) { | |
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | |
if (m) return m.call(o); | |
return { | |
next: function () { | |
if (o && i >= o.length) o = void 0; | |
return { value: o && o[i++], done: !o }; | |
} | |
}; |
This file contains hidden or 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' | |
class ScriptLoader extends React.Component { | |
state = { | |
loaded: false | |
} | |
componentDidMount() { | |
const script = document.createElement('script') | |
This file contains hidden or 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, { Component } from 'react'; | |
import Aux from './hoc/Aux'; | |
import './App.css'; | |
import First from './Container/First'; | |
class App extends Component { | |
constructor() | |
{ | |
super(); | |
this.state={ |