Skip to content

Instantly share code, notes, and snippets.

View mohandere's full-sized avatar
🎯
Focusing

Mohan Dere mohandere

🎯
Focusing
View GitHub Profile
@mohandere
mohandere / rootEpic.js
Created February 16, 2018 12:24
rootEpic.js
import {
combineEpics
} from 'redux-observable';
// Import feature wise epic
import common from './common/epics';
import catalog from './catalog/epics';
import home from './home/epics';
import archives from './archives/epics';
@mohandere
mohandere / index.js
Last active February 16, 2018 13:01
routes.js + index.js
// File - src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import registerServiceWorker from './registerServiceWorker';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'react-router-redux';
// Import store and history
import store, { history } from './store';
@mohandere
mohandere / epicGetProducts.js
Last active February 16, 2018 13:17
Epic getProducts.js
import {
ajax
} from 'rxjs/observable/dom/ajax';
import 'rxjs/add/operator/catch'
import 'rxjs/add/operator/debounceTime'
import queryString from 'query-string'
import {
Observable
} from 'rxjs/Observable';
@mohandere
mohandere / index.js
Last active February 19, 2018 10:07
react-router-redux integration example
// src/index.js
import createHistory from 'history/createBrowserHistory'
import { ConnectedRouter, routerReducer } from 'react-router-redux'
import { Route } from 'react-router'
import { Provider } from 'react-redux'
// Other imports ...
// Add the reducer to your store on the `router` key
// Also apply our middleware for navigating
@mohandere
mohandere / UserRepos.js
Last active February 19, 2018 11:09
UserRepos.js - Container component example
// File- src/home/containers/UserRepos.js
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux'
// Import dumb component
import Repo from '../components/Repo';
// Actions
import { doUserRepos } from '../actions/doUserRepos';
@mohandere
mohandere / epicGetUserRepos.js
Last active February 19, 2018 14:53
Epic get github user repos
import { ajax } from 'rxjs/observable/dom/ajax';
import 'rxjs/add/operator/catch'
import {
REQUEST_USER_REPOS_START
} from '../actions/actionTypes';
import {
doUserReposFulfilled,
doUserReposFailed
} from '../actions/doUserRepos';
@mohandere
mohandere / App.js
Last active March 11, 2018 07:35
Code Splitting - dynamic import
import React, { Component } from 'react';
class App extends Component {
handleClick = () => {
import ('./moduleA')
.then(({
moduleA
}) => {
// Use moduleA
})
@mohandere
mohandere / asyncRoutes.js
Created March 11, 2018 11:34
asyncRoutes in CRA
import React from 'react';
import {
Route,
Switch
} from 'react-router';
import Loadable from 'react-loadable';
import AppLoader from './common/components/AppLoader';
// Import modules/routes
import About from './about';
import React, { Component } from 'react';
import{
Grid, Row, Col,
FormGroup, ControlLabel
} from 'react-bootstrap';
import { Field, reduxForm } from 'redux-form'
import { renderInputField, required, email } from 'utils/form-helpers'
let SettingsForm = props => {
const { handleSubmit, submitting } = props
@mohandere
mohandere / App.css
Last active May 30, 2018 10:50
App.css - Obfuscate CSS class names in Create React App without eject
// File - src/App.css
.App {
text-align: center;
}
.AppLogo {
height: 80px;
}