Made sidebars toggleable

Summary:
Implemented a first button: make main menu collapsible.

Also introduced some additional utilities and hooked up startup performance logging

Reviewed By: cekkaewnumchai

Differential Revision: D23783500

fbshipit-source-id: 2456fd781a52d497facbaccfabe885e4f8c408c5
This commit is contained in:
Michel Weststrate
2020-09-21 11:50:45 -07:00
committed by Facebook GitHub Bot
parent 95638af321
commit e7fdd8332d
5 changed files with 136 additions and 54 deletions

View File

@@ -0,0 +1,35 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {
useSelector,
shallowEqual,
useDispatch as useDispatchBase,
} from 'react-redux';
import {Dispatch} from 'redux';
import {State, Actions} from '../reducers/index';
/**
* Strongly typed wrapper or Redux's useSelector.
*
* Equality defaults to shallowEquality
*/
export function useStore<Selected>(
selector: (state: State) => Selected,
equalityFn: (left: Selected, right: Selected) => boolean = shallowEqual,
): Selected {
return useSelector(selector, equalityFn);
}
/**
* Strongly typed useDispatch wrapper for the Flipper redux store.
*/
export function useDispatch(): Dispatch<Actions> {
return useDispatchBase();
}