Skip to content

Instantly share code, notes, and snippets.

export default combineReducers({
app,
form: formReducer,
})
const Api = function(params) {
const _store_ = {
accessToken: null,
}
return {
getAccessToken() {
return _store.accessToken
},
async login() {
const characters = []
const Warrior = function createWarrior(name) {
this.name = name
this.hp = 100
this.mp = 100
this.defence = 60
return {
// Slash the enemy, decreasing their hp down by 35
const massCreateWarriors = function(names) {
return (onCreate) => {
const warriors = []
names.forEach((name) => {
const newWarrior = new Warrior(name)
if (onCreate) onCreate(newWarrior)
warriors.push(newWarrior)
})
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import './styles.css'
import * as serviceWorker from './serviceWorker'
ReactDOM.render(<App />, document.getElementById('root'))
serviceWorker.unregister()
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto',
'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
import React, { useState } from 'react'
const App = () => {
const [name, setName] = useState('')
const [gender, setGender] = useState('Male')
const onNameChange = (e) => setName(e.target.value)
const onGenderChange = (e) => setGender(e.target.value)
return <div />
}
const App = () => {
const [name, setName] = useState('')
const [gender, setGender] = useState('Male')
const onNameChange = (e) => setName(e.target.value)
const onGenderChange = (e) => setGender(e.target.value)
return (
<div>
<form className="form">
<div>
form {
display: flex;
align-items: center;
}
form > div {
margin: auto 3px;
}
input,
select {
transition: all 0.15s ease-out;
const useApp = () => {
const onSubmit = (e) => {
e.preventDefault()
console.log('Submitted')
}
return {
onSubmit,
}
}