Commit 9db6790 1 parent 130831b commit 9db6790 Copy full SHA for 9db6790
File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ export type UseModal<T = unknown> = {
109
109
* Function for opening the modal. Called upon a variable initialized with 'useModal()'.
110
110
* Most often used in onClick functions (ex. inside the onClick prop of the Button component)
111
111
*/
112
- onOpen : ( value : T | null ) => void ;
112
+ onOpen : ( value ? : T | null ) => void ;
113
113
114
114
/**
115
115
* Used for fetching or storing the state of the modal. Called upon a variable initialized with 'useModal()'.
@@ -130,9 +130,9 @@ export function useModal<T = unknown>(): UseModal<T> {
130
130
const [ isOpen , setIsOpen ] = React . useState ( false ) ;
131
131
const [ state , setState ] = React . useState < T | null > ( null ) ;
132
132
133
- const onOpen = ( value : T | null ) => {
133
+ const onOpen = ( value ? : T | null ) => {
134
134
setIsOpen ( true ) ;
135
- setState ( value ) ;
135
+ setState ( value ? value : null ) ;
136
136
} ;
137
137
138
138
const onClose = ( ) => setIsOpen ( false ) ;
You can’t perform that action at this time.
0 commit comments