Skip to main content
You are viewing the documentation for InstantSearch.js v4. To upgrade from v3, see the migration guide. Looking for the v3 version of this page? View the v3 docs.
Signature
const routing = {
  stateMapping: simple(),
};

Import

import { simple } from "instantsearch.js/es/lib/stateMappings";

About this widget

This simple state mapping is the default for the instantsearch object’s routing option. The router provides an API that lets you customize some of its behaviors. To get a sense of what you can do with the API, see Routing URLs. The only transformation applied by the function is the omission of configure.
JavaScript
simple().stateToRoute({
  instant_search: {
    query: "Apple",
    page: 5,
    configure: {
      hitsPerPage: 4,
    },
  },
});

// gives as output:
// {
//   instant_search: {
//     query: 'Apple',
//     page: 5,
//   },
// }

Examples

JavaScript
instantsearch({
  // ...
  routing: {
    stateMapping: simple(),
  },
});
I