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:
committed by
Facebook GitHub Bot
parent
95638af321
commit
e7fdd8332d
35
desktop/app/src/utils/useStore.tsx
Normal file
35
desktop/app/src/utils/useStore.tsx
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user