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
const USER_LOGGED_IN = '*/user/USER_LOGGED_IN' | |
const apiUrl = 'http://localhost:3000/api/login' | |
// If you haven't already installed redux-thunk middleware | |
// just do it LOL: https://github.com/gaearon/redux-thunk | |
// then doDis | |
function login ({ username, password }) { | |
return dispatch => { | |
fetch(`${apiUrl}`, { | |
method: 'POST', |
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 and router | |
import React, { Component } from 'react'; | |
import { Route } from 'react-router-dom'; | |
import Home from './Home' | |
export default class App extends Component { | |
render() { | |
return ( | |
<div> | |
{/* this is how you add comments inside react render function -> jsx */} |
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
// you can replace constructor with this | |
class Dashboard extends Component { | |
state = { | |
user: {} | |
} | |
componentDidMount() {...} | |
render() {...} |
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
// That first component lul | |
... | |
render() { | |
return ( | |
... | |
<Notification error={this.state.error} success={this.state.success} /> | |
... | |
) | |
} |
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
export default ({ error, success }) => { | |
const message = error.message ? error.message : success.message | |
return ( | |
<div> | |
{message} | |
</div> | |
) | |
} |
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
// smart boi with redux would do it like this | |
store = { | |
notification: { | |
status: 'error', | |
message: 'Error message' | |
} || { | |
status: 'success', | |
message: 'Success message' | |
} | |
} |
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
class FirstComponent extends Component { | |
state = { | |
a: 2 | |
} | |
changeState = val => { | |
this.setState({ | |
a: val | |
}) | |
} |
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
activate-power-mode@1.4.0 | |
apex-syntax@0.1.0 | |
apex-ui@0.2.1 | |
ariake-dark-syntax@0.1.3 | |
atom-beautify@0.29.24 | |
atom-clock@0.1.7 | |
atom-material-syntax@1.0.6 | |
atom-material-ui@1.3.10 | |
atom-ternjs@0.18.3 | |
aurora-theme@1.2.2 |
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
class E extends PureComponent { | |
changeText = e => { | |
this.setState({ | |
text: e.target.value | |
}); | |
} | |
render() { | |
return ( | |
<div onClick={this.changeText} /> |
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
.icon::before { | |
animation: cc 5s infinite linear; | |
} | |
@keyframes cc { | |
0% { | |
color: #fff; | |
} | |
10% { |