Skip to content

Instantly share code, notes, and snippets.

View pmqa's full-sized avatar
🏠
Working from home

Pedro Almeida pmqa

🏠
Working from home
View GitHub Profile
@pmqa
pmqa / Reducer.js
Created January 11, 2018 19:44
Reducer
import dotprop from 'dot-prop-immutable';
import {
UPDATE_POST_TITLE,
LOAD_APP
} from './../constants/actionTypes';
export default (state = {}, action) => {
switch (action.type) {
case LOAD_APP:
@pmqa
pmqa / App.js
Created January 11, 2018 19:41
The App
import React, { Component } from 'react';
import './App.css';
import State from './State';
import Posts from './components/Posts';
import { LOAD_APP } from './constants/actionTypes';
import { connect } from 'react-redux';
const mapDispatchToProps = dispatch => ({
onLoad: (payload) => {
dispatch({ type: LOAD_APP, payload })
@pmqa
pmqa / Posts.js
Created January 11, 2018 19:36
Posts Component
import React from 'react';
import { connect } from 'react-redux';
import {
UPDATE_POST_TITLE
} from './../constants/actionTypes';
const mapDispatchToProps = dispatch => ({
updatePostTitle: (payload) =>
dispatch({ type: UPDATE_POST_TITLE, payload })
});
import React from 'react';
import { connect } from 'react-redux';
import {
UPDATE_POST_TITLE
} from './../constants/actionTypes';
const mapDispatchToProps = dispatch => ({
updatePostTitle: (payload) =>
dispatch({ type: UPDATE_POST_TITLE, payload })
});
@pmqa
pmqa / app.js
Created July 28, 2017 21:50
React.js testing gist
import React, { Component } from 'react';
import ReactDOM from "react-dom";
class App extends Component {
constructor() {
super();
this.state = {
loading: true
};
}