You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
storageGroupKey?: string;//defaults to localDropdown
12
-
onOptionSelected?: (option: string)=>void;
13
-
searchDefaultValue?: string;
14
-
excludedFromStorage?: {values: string[];compareOptions?: CompareOptions[]};// if the value is in this list it will not be added to the storage //setting this to null will assume all values are valid
const[propRef]=useDefaultsByRef<LocalStorageDropdownProps>(_props,LOCAL_STORAGE_DROPDOWN_DEFAULTS);// for unmounting
73
61
const[options,setOptions]=useState<string[]>();// initially built with useLocalStorage however as state setters don't work during unmount changed to a common state
74
62
const[inputText,setInputText]=useState(props.buttonName??'');// holds the current option independent of input field or dropdown so it can be collected if necessary
75
63
constinputTextRef=useRef<string>();//ref is used to access data from a pointer which in turn can be access in the unmounting
* Note that a ref object can be linked to the component
7
+
* @buttonName {string} - The name of the button
8
+
* @storageKey {string} - The key inside the storage group
9
+
* @storageGroupKey {string, optional} - The key of the local storage value (defaults to localDropdown)
10
+
* @onOptionSelected {function, optional} - The function that will be called when an option is selected
11
+
* @searchDefaultValue {string, optional} - The default value of the search bar (similar to buttonName)
12
+
* @excludedFromStorage {object, optional} - Decided what values are exempt from being added to the storage - defaults to "starting with 'select' or 'enter'"
13
+
*/
14
+
15
+
exporttypeLocalStorageDropdownProps={
16
+
buttonName: string;
17
+
storageKey: string;
18
+
storageGroupKey?: string;//defaults to localDropdown
19
+
onOptionSelected?: (option: string)=>void;
20
+
searchDefaultValue?: string;
21
+
excludedFromStorage?: {values: string[];compareOptions?: CompareOptions[]};// if the value is in this list it will not be added to the storage //setting this to null will assume all values are valid
0 commit comments