LogoLogo
  • Welcome
  • What's new?
  • Docs
    • User guides
      • Get Started
      • Kepler.gl workflow
        • Add data to layers
          • Adding Data Layers
          • Create a Layer
          • Blend and Rearrange Layers
          • Hide, Edit and Delete Layers
        • Add Data to the Map
      • Layers
        • Point
        • S2 Layer
        • Icon
        • Line
        • Cluster
        • Polygon
        • Hexbin
        • Grid
        • H3
        • Heatmap
        • Arc
        • Trip layer
      • Layer Attributes
      • Color Palettes
      • Filters
      • Map Styles
      • Interactions
      • Map Settings
      • Time Playback
      • Save and Export
      • FAQ
    • API Reference
      • ecosystem
      • Get Started
      • Advanced usages
        • Saving and Loading Maps with Schema Manager
        • Replace UI Component with Component Dependency Injection
        • Forward Dispatch Actions
        • Reducer Plugin
        • Using Updaters
        • Custom reducer initial state
        • custom-mapbox-host
      • Components
      • Reducers
        • reducers
        • map-style
        • map-state
        • combine
        • overview
        • ui-state
        • vis-state
      • Processors
        • All processors
      • Schemas
      • Actions
        • All actions
      • Cloud providers
        • Provider
      • Custom theme
      • Localization
    • Jupyter Notebook
  • Examples
    • Node/Express
    • Demo App
    • Open modal
    • Open modal
    • UMD client
    • Customize kepler.gl Theme
    • Customize kepler.gl Reducer
  • Contributing
    • Developing Kepler.gl
    • Contributor Covenant Code of Conduct
  • Change Log
  • Upgrade Guide
Powered by GitBook
On this page
  • keplerGlReducer
  • mapStateLens
  • mapStyleLens
  • providerStateLens
  • uiStateLens
  • visStateLens

Was this helpful?

  1. Docs
  2. API Reference
  3. Reducers

reducers

PreviousReducersNextmap-style

Last updated 5 months ago

Was this helpful?

Table of Contents

keplerGlReducer

Kepler.gl reducer to be mounted to your store. You can mount keplerGlReducer at property keplerGl, if you choose to mount it at another address e.g. foo you will need to specify it when you mount KeplerGl component in your app with getState: state => state.foo

Examples

import keplerGlReducer from '@kepler.gl/reducers';
import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
import {taskMiddleware} from 'react-palm/tasks';

const initialState = {};
const reducers = combineReducers({
  // <-- mount kepler.gl reducer in your app
  keplerGl: keplerGlReducer,

  // Your other reducers here
  app: appReducer
});

// using createStore
export default createStore(reducer, initialState, applyMiddleware(taskMiddleware));

keplerGlReducer.initialState

Return a reducer that initiated with custom initial state. The parameter should be an object mapping from subreducer name to custom subreducer state, which will be shallow merged with default initial state.

Default subreducer state:

Parameters

Examples

const myKeplerGlReducer = keplerGlReducer
 .initialState({
   uiState: {readOnly: true}
 });

keplerGlReducer.plugin

Returns a kepler.gl reducer that will also pass each action through additional reducers spiecified. The parameter should be either a reducer map or a reducer function. The state passed into the additional action handler is the instance state. It will include all the subreducers visState, uiState, mapState and mapStyle. .plugin is only meant to be called once when mounting the keplerGlReducer to the store. Note This is an advanced option to give you more freedom to modify the internal state of the kepler.gl instance. You should only use this to adding additional actions instead of replacing default actions.

Parameters

Examples

const myKeplerGlReducer = keplerGlReducer
 .plugin({
   // 1. as reducer map
   HIDE_AND_SHOW_SIDE_PANEL: (state, action) => ({
     ...state,
     uiState: {
       ...state.uiState,
       readOnly: !state.uiState.readOnly
     }
   })
 })
.plugin(handleActions({
  // 2. as reducer
  'HIDE_MAP_CONTROLS': (state, action) => ({
    ...state,
    uiState: {
      ...state.uiState,
      mapControls: hiddenMapControl
    }
  })
}, {}));

mapStateLens

Parameters

  • reduxState any

mapStyleLens

Parameters

  • reduxState any

providerStateLens

Parameters

  • reduxState any

uiStateLens

Parameters

  • reduxState any

visStateLens

Parameters

  • reduxState any

iniSt custom state to be merged with default initial state

customReducer ( | ) A reducer map or a reducer

Connect subreducer mapState, used with injectComponents. Learn more at

Connect subreducer mapStyle, used with injectComponents. Learn more at

Connect subreducer providerState, used with injectComponents. Learn more at

Connect subreducer uiState, used with injectComponents. Learn more at

Connect subreducer visState, used with injectComponents. Learn more at

Object
Object
Function
keplerGlReducer
keplerGlReducer.initialState
keplerGlReducer.plugin
mapStateLens
mapStyleLens
providerStateLens
uiStateLens
visStateLens
Replace UI Component
Replace UI Component
Replace UI Component
Replace UI Component
Replace UI Component
uiState
mapState
mapStyle
visState