-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added readme documentation to mobileMiddleware.
- Loading branch information
1 parent
cd2f040
commit 56d9bbe
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
mobileMiddleware | ||
=========== | ||
|
||
`mobileMiddleware` is a very simple [redux middleware](https://redux.js.org/docs/advanced/Middleware.html) that sets the isSidebarOpened flag to false on REDUX_REHYDRATE payloads. | ||
This useful to make isSidebarOpened false on mobile even if the value that was saved to local storage was true. | ||
The middleware just needs to be added to the enhancers list: | ||
|
||
```js | ||
const enhancers = [ | ||
... | ||
applyMiddleware( mobileMiddleware ), | ||
]; | ||
... | ||
const store = createStore( reducer, flowRight( enhancers ) ); | ||
``` |