Basic react page in place
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
export const ACTION_NAME = 'ACTION_NAME';
|
||||
|
||||
export function actionName() {
|
||||
return {
|
||||
type: ACTION_NAME
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
|
||||
export default class App extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
render() {
|
||||
return <p>Hello world</p>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import { createDevTools } from 'redux-devtools';
|
||||
import LogMonitor from 'redux-devtools-log-monitor';
|
||||
import DockMonitor from 'redux-devtools-dock-monitor';
|
||||
|
||||
export default createDevTools(
|
||||
<DockMonitor toggleVisibilityKey='ctrl-h' changePositionKey='ctrl-q' defaultIsVisible={false}>
|
||||
<LogMonitor theme='tomorrow' />
|
||||
</DockMonitor>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Provider } from 'react-redux';
|
||||
import { createStore, applyMiddleware, compose } from 'redux';
|
||||
import thunk from 'redux-thunk';
|
||||
|
||||
import DevTools from './dev_tools.jsx';
|
||||
import App from './components/app.jsx';
|
||||
|
||||
import reducer from './reducers/reducer.jsx';
|
||||
|
||||
var store = createStore(
|
||||
reducer,
|
||||
{}, //initial state
|
||||
compose(
|
||||
applyMiddleware(thunk),
|
||||
DevTools.instrument()
|
||||
)
|
||||
);
|
||||
|
||||
//start the process
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<div>
|
||||
<App />
|
||||
<DevTools />
|
||||
</div>
|
||||
</Provider>,
|
||||
document.querySelector("#root")
|
||||
);
|
||||
@@ -0,0 +1,14 @@
|
||||
import { ACTION_NAME } from "../actions/actions.jsx";
|
||||
|
||||
const initialState = {};
|
||||
|
||||
export default function reducer(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case ACTION_NAME:
|
||||
//DO NOTHING
|
||||
return state;
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user