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
| export default combineReducers({ | |
| app, | |
| form: formReducer, | |
| }) |
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 Api = function(params) { | |
| const _store_ = { | |
| accessToken: null, | |
| } | |
| return { | |
| getAccessToken() { | |
| return _store.accessToken | |
| }, | |
| async login() { |
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 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 |
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 massCreateWarriors = function(names) { | |
| return (onCreate) => { | |
| const warriors = [] | |
| names.forEach((name) => { | |
| const newWarrior = new Warrior(name) | |
| if (onCreate) onCreate(newWarrior) | |
| warriors.push(newWarrior) | |
| }) | |
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 ReactDOM from 'react-dom' | |
| import App from './App' | |
| import './styles.css' | |
| import * as serviceWorker from './serviceWorker' | |
| ReactDOM.render(<App />, document.getElementById('root')) | |
| serviceWorker.unregister() |
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
| 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; | |
| } |
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, { 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 /> | |
| } |
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 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> |
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
| form { | |
| display: flex; | |
| align-items: center; | |
| } | |
| form > div { | |
| margin: auto 3px; | |
| } | |
| input, | |
| select { | |
| transition: all 0.15s ease-out; |
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 useApp = () => { | |
| const onSubmit = (e) => { | |
| e.preventDefault() | |
| console.log('Submitted') | |
| } | |
| return { | |
| onSubmit, | |
| } | |
| } |