Created
April 17, 2020 07:28
-
-
Save from-unknown/b78c00f4d8dd7bfa63e3572b3843caef to your computer and use it in GitHub Desktop.
show state or saved value and when delete all inputs, still show empty field
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
// show state or saved value and when delete all inputs, still show empty field | |
export const showStateOrSavedValue: (state: string, savedValue: string) => string = ( | |
state, | |
savedValue, | |
) => { | |
return state || state === '' ? state : savedValue; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for React, such as show saved value or input value (saved to state).