Skip to content

Instantly share code, notes, and snippets.

View gminova's full-sized avatar
:octocat:
Focusing

Gergana ゲルガナ gminova

:octocat:
Focusing
View GitHub Profile
@gminova
gminova / redux_consts.jsx
Created November 25, 2019 15:28
FCC - Redux Consts
const LOGIN = 'LOGIN';
const LOGOUT = 'LOGOUT'
const defaultState = {
authenticated: false
};
const authReducer = (state = defaultState, action) => {
switch (action.type) {
@gminova
gminova / redux_switch_case.jsx
Created November 25, 2019 15:05
FCC - Redux Switch Case
const defaultState = {
authenticated: false
};
const authReducer = (state = defaultState, action) => {
switch (action.type) {
case 'LOGIN': return { authenticated: true };
break;
case 'LOGOUT': return { authenticated: false };
break;
@gminova
gminova / dispatch_login_action.jsx
Created November 25, 2019 15:00
FCC - Redux Dispatch Login Action
const defaultState = {
login: false
};
const reducer = (state = defaultState, action) => {
if(action.type === "LOGIN") {
return {
login: true
}
} else {
@gminova
gminova / dispatch_action.jsx
Created November 25, 2019 14:52
FCC - Redux Dispatch Action
const store = Redux.createStore(
(state = {login: false}) => state
);
const loginAction = () => {
return {
type: 'LOGIN'
}
};
@gminova
gminova / action_creator.jsx
Last active November 25, 2019 14:45
FCC - Redux Action Creator
const action = {
type: 'LOGIN'
}
function actionCreator() {
return action;
}
@gminova
gminova / redux_action.jsx
Created November 25, 2019 14:40
FCC - Redux Action
const action = {
type: "LOGIN",
}
@gminova
gminova / getState.jsx
Created November 25, 2019 14:32
FCC = Redux getState()
const store = Redux.createStore(
(state = 5) => state
);
const currentState = store.getState();
@gminova
gminova / create_store.jsx
Created November 25, 2019 14:26
FCC - Redux
const reducer = (state = 5) => {
return state;
}
const store = Redux.createStore(reducer);
@gminova
gminova / SSR.jsx
Created November 25, 2019 14:09
FCC - React SSR
class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return <div/>
}
};
ReactDOMServer.renderToString(<App />)
@gminova
gminova / map.jsx
Created November 25, 2019 13:57
FCC - React Map
const frontEndFrameworks = [
'React',
'Angular',
'Ember',
'Knockout',
'Backbone',
'Vue'
];
function Frameworks() {