Commit 77e39452 authored by Bastien Alvez's avatar Bastien Alvez

Create React App + Redux Basic Integration

# See for more about ignoring files.
# dependencies
# testing
# production
# misc
This diff is collapsed.
"name": "map-sphere",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-redux": "^5.0.3",
"redux": "^3.6.0"
"devDependencies": {
"react-scripts": "0.9.5"
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
Notice the use of %PUBLIC_URL% in the tag above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
<title>React App</title>
<div id="root"></div>
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
.App {
height: 100vh;
width: 100vw;
background-color: red;
\ No newline at end of file
import React, { Component } from 'react';
import './App.css';
import MapContainer from "./components/MapContainer";
class App extends Component {
render() {
return (
<div className="App">
<MapContainer />
export default App;
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
export const ADD_DATA = 'ADD_DATA';
\ No newline at end of file
import * as types from './action-types';
export const addData = (data) => {
return {
type: types.ADD_DATA,
\ No newline at end of file
import React, {PropTypes, Component} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import * as basicActions from '../actions/basic-actions';
class mapContainer extends Component {
render() {
const {basic} = this.props;
return (
mapContainer.propTypes = {
basic: PropTypes.object.isRequired,
actions: PropTypes.object.isRequired
function mapStateToProps(state, props) {
return {
basic: state.basic
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(basicActions, dispatch),
export default connect(mapStateToProps, mapDispatchToProps)(mapContainer);
body {
margin: 0;
padding: 0;
font-family: sans-serif;
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
import {Provider} from 'react-redux';
import configureStore from './store/configure-store';
const store = configureStore();
<Provider store={store}>
<App />
// import * as types from '../actions/action-types';
export default (state = {value: "basic"}, action) => {
switch (action.type) {
return state;
import {combineReducers} from 'redux';
import basic from './basic-reducer.js';
const rootReducer = combineReducers({
export default rootReducer;
import rootReducer from '../reducers';
import {createStore} from 'redux';
export default (initialState) => {
return createStore(rootReducer, initialState);
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment