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 LOGIN = 'LOGIN'; | |
| const LOGOUT = 'LOGOUT' | |
| const defaultState = { | |
| authenticated: false | |
| }; | |
| const authReducer = (state = defaultState, action) => { | |
| switch (action.type) { |
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 defaultState = { | |
| authenticated: false | |
| }; | |
| const authReducer = (state = defaultState, action) => { | |
| switch (action.type) { | |
| case 'LOGIN': return { authenticated: true }; | |
| break; | |
| case 'LOGOUT': return { authenticated: false }; | |
| break; |
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 defaultState = { | |
| login: false | |
| }; | |
| const reducer = (state = defaultState, action) => { | |
| if(action.type === "LOGIN") { | |
| return { | |
| login: true | |
| } | |
| } else { |
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 store = Redux.createStore( | |
| (state = {login: false}) => state | |
| ); | |
| const loginAction = () => { | |
| return { | |
| type: '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 action = { | |
| type: 'LOGIN' | |
| } | |
| function actionCreator() { | |
| return action; | |
| } |
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 action = { | |
| type: "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 store = Redux.createStore( | |
| (state = 5) => state | |
| ); | |
| const currentState = store.getState(); |
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 reducer = (state = 5) => { | |
| return state; | |
| } | |
| const store = Redux.createStore(reducer); |
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
| class App extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| } | |
| render() { | |
| return <div/> | |
| } | |
| }; | |
| ReactDOMServer.renderToString(<App />) |
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 frontEndFrameworks = [ | |
| 'React', | |
| 'Angular', | |
| 'Ember', | |
| 'Knockout', | |
| 'Backbone', | |
| 'Vue' | |
| ]; | |
| function Frameworks() { |