UI libraries
/
InstantSearch.js
/
Widgets
Nov 14, 2024
simple
Signature
const routing = { stateMapping: simple(), };
Import
Copy
1
import { simple } from 'instantsearch.js/es/lib/stateMappings';
About this widget
You are currently reading the documentation for InstantSearch.js v4. Read our migration guide to learn how to upgrade from v3 to v4. You can still access the V3 documentation for this page.
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 the Routing URLs guide.
The only transformation applied by the function is the omission of configure
.
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
simple().stateToRoute({
instant_search: {
query: 'Apple',
page: 5,
configure: {
hitsPerPage: 4,
},
},
});
// gives as output:
// {
// instant_search: {
// query: 'Apple',
// page: 5,
// },
// }
Examples
Copy
1
2
3
4
5
6
instantsearch({
// ...
routing: {
stateMapping: simple(),
},
});
Did you find this page helpful?