Skip to content

File Structure

Michael Niday edited this page Jun 6, 2018 · 1 revision

Files do not need to be structured into specific directories, but certain components are needed.

As an example, view src/api and src/store for a minimal setup

src/api

  • config.js: Utilizes EntitiesConfig from redux-capacitor
  • client.js: Sets up an api client
  • records.js: Record and schema definitions
  • resource_config.js: Resource definitions

src/store

  • configureStore.js: Combine reducers with EntitiesModule.rootReducer
  • react-redux-saga.js: Provide a Saga component that wraps our react-redux Provider
  • rootSaga.js: Runs in the background to perform ajax requests

index.js

Combines the store and saga configuration pieces to wrap the app in the appropriate providers

ReactDOM.render(
  <Sagas middleware={sagaMiddleware}>
    <Provider store={store}>
      <App />
    </Provider>
  </Sagas>,
  document.getElementById('root')
)

Clone this wiki locally