Skip to content

Instantly share code, notes, and snippets.

@gustavonecore
Last active March 26, 2018 14:27
Show Gist options
  • Save gustavonecore/e0631fc6cc734ce952eb3a828ce93021 to your computer and use it in GitHub Desktop.
Save gustavonecore/e0631fc6cc734ce952eb3a828ce93021 to your computer and use it in GitHub Desktop.
Container/App.js
import '../Config';
import DebugConfig from '../Config/DebugConfig';
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import LoginContainer from './LoginContainer';
import HomeContainer from './HomeContainer';
import TransactionLayout from './Layout/TransactionLayout';
import CreateTransactionLayout from './Layout/CreateTransactionLayout';
import createStore from '../Redux';
import { Router, Route, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
// create our store
const store = createStore()
const history = syncHistoryWithStore(browserHistory, store);
const test = () => {
console.log('on enter calñback');
}
/**
* Provides an entry point into our application. Both index.ios.js and index.android.js
* call this component first.
*
* We create our Redux store here, put it into a provider and then bring in our
* RootContainer.
*
* We separate like this to play nice with React Native's hot reloading.
*/
class App extends Component {
render () {
return (
<Provider store={store}>
<Router history={history}>
<Route path="/" component={HomeContainer}></Route>
<Route path="/login" component={LoginContainer}></Route>
<Route path="/entity/transaction" component={TransactionLayout}></Route>
<Route path="/entity/transaction/new" component={CreateTransactionLayout}></Route>
</Router>
</Provider>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment