Skip to content

Instantly share code, notes, and snippets.

View rohanBagchi's full-sized avatar

Rohan Bagchi rohanBagchi

View GitHub Profile
import { createStore } from 'redux';
import rootReducer from './rootReducer.js';
const store = createStore(rootReducer);
export default store;
import { combineReducers } from 'redux';
import ArticleDucks from './ducks/ArticleDucks';
export default combineReducers({
articles_reducer: ArticleDucks,
});
import { createAction } from 'redux-actions';
import keyMirror from 'keymirror';
export const default_state = {
data: {},
ui: {}
};
export const ArticleActionTypes = keyMirror({
SET_ARTICLES: null,
import React from 'react';
import { connect } from 'react-redux';
const User = props => (
<div>
{props.user.name}
</div>
);
function mapStateToProps(state) {
const defaultState = {
user: {}
};
export default function reducer(state, action) {
state = state || defaultState;
const { type, payload } = action;
switch (type) {
case 'SET_USER_DETAILS':
import ChatBubble from './ChatBubble';
import ImageGallery from 'some-custom-gallery';
...
<ChatBubble sentBy={message.sentBy} time={message.time}>
<div className="message-body-wrapper">
{message.images.length &&
<ImageGallery images=[message.images]/>
}
{message.messageText}
import React from 'react';
export default ChatBubble = props => {
return (
<div className='wrapper'>
<Header {...props}/>
<div className='body'>
{props.children}
</div>
<Footer {...props}/>
import React from 'react';
export default ChatBubble = props => {
return (
<div className='wrapper'>
<Header {...props}/>
<div className='body'>
<div className='messageContent'>
{props.messageContent}
</div>
import React from 'react';
export default ChatBubble = props => {
return (
<div className='wrapper'>
<div className='header'>
<div className='sentBy'>
{props.sentBy}
</div>
<div className='avatar'>
import React from 'react';
export default Icon = props => (
<i className={props.name}/>
);