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
import dispatcher from "../Dispatcher"; | |
export const COLOR_APP_ACTIONS = { | |
CHANGE_COLOR: 'colorAppActions.ChangeColor' | |
}; | |
export function changeColor(colorName) { | |
dispatcher.dispatch({ | |
type: COLOR_APP_ACTIONS.CHANGE_COLOR, | |
value: colorName |
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
import dispatcher from "../Dispatcher"; | |
import {EventEmitter} from "events"; | |
import * as ColorAppActions from "../actions/ColorAppActions"; | |
class ColorAppStore extends EventEmitter { | |
constructor() { | |
super(); | |
this.activeColor = "lightgrey"; | |
} |
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
import React from "react"; | |
import ColorAppStore from "../stores/ColorAppStore"; | |
export default class ColorComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
color: ColorAppStore.getActiveColor() | |
} |
OlderNewer