Skip to content

Commit

Permalink
Add usecallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Esteban Beltran committed Feb 16, 2022
1 parent 8b159d2 commit 1486a88
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@
* 2.0.
*/

import { useCallback } from 'react';
import { CasesContextStoreActionsList } from '../../cases_context/cases_context_reducer';
import { useCasesContext } from '../../cases_context/use_cases_context';
import { CreateCaseFlyoutProps } from './create_case_flyout';

export const useCasesAddToNewCaseFlyout = (props: CreateCaseFlyoutProps) => {
const context = useCasesContext();
const closeFlyout = () => {

const closeFlyout = useCallback(() => {
context.dispatch({
type: CasesContextStoreActionsList.CLOSE_CREATE_CASE_FLYOUT,
});
};
const openFlyout = () => {
}, [context]);

const openFlyout = useCallback(() => {
context.dispatch({
type: CasesContextStoreActionsList.OPEN_CREATE_CASE_FLYOUT,
payload: {
Expand All @@ -35,7 +38,7 @@ export const useCasesAddToNewCaseFlyout = (props: CreateCaseFlyoutProps) => {
},
},
});
};
}, [closeFlyout, context, props]);
return {
open: openFlyout,
close: closeFlyout,
Expand Down

0 comments on commit 1486a88

Please sign in to comment.