Skip to content

Commit

Permalink
feat: use selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
zeevo committed May 11, 2020
1 parent eccf60e commit b16e89c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta property="og:title" content="FHIR App Starter" />
<meta property="og:url" content="https://github.com/zeevosec/fhir-app-starter" />
<meta property="og:description" content="FHIR App Starter: start your app logic right away" />
<meta property="og:image" content="TODO" />
<meta property="og:image" content="%PUBLIC_URL%/media/meta-icons/favicon.ico" />
<meta property="og:type" content="website" />
<meta name="theme-color" content="#000000" />
<meta name="apple-mobile-web-app-title" content="FHIR App Starter" />
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.1",
"regenerator-runtime": "^0.13.3",
"reselect": "^4.0.0",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.88.2",
"styled-components": "^4.4.0",
Expand Down
4 changes: 2 additions & 2 deletions src/containers/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Router, Switch, Route } from 'react-router-dom';
import { Helmet } from 'react-helmet-async';
import { Grid, Container, Header, Divider } from 'semantic-ui-react';

import { getConfig } from './selectors';
import config from '../../config';
import history from '../../modules/history';
import Home from '../Home';
Expand Down Expand Up @@ -47,8 +48,7 @@ class App extends React.Component {
}

function mapStateToProps(state) {
// TODO: replace with selector here
return { loaded: !!state.app.config };
return { loaded: !!getConfig(state) };
}

function mapDispatchToProps(dispatch) {
Expand Down
9 changes: 7 additions & 2 deletions src/containers/App/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
* The App state selectors
*/

// import { createSelector } from 'reselect';
// import { initialState } from './reducers';
import { createSelector } from 'reselect';

export const getApp = state => state.app;

export const getConfig = createSelector([getApp], app => {
return app.config;
});
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11756,6 +11756,11 @@ requires-port@^1.0.0:
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=

reselect@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.0.0.tgz#f2529830e5d3d0e021408b246a206ef4ea4437f7"
integrity sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==

resolve-cwd@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a"
Expand Down

0 comments on commit b16e89c

Please sign in to comment.