1 | import { createContext, useContext } from 'react';
|
2 | import { noop } from '../utils';
|
3 | export const defaultContext = {
|
4 | activeIndex: -1,
|
5 | hintText: '',
|
6 | id: '',
|
7 | initialItem: null,
|
8 | inputNode: null,
|
9 | isOnlyResult: false,
|
10 | onActiveItemChange: noop,
|
11 | onAdd: noop,
|
12 | onInitialItemChange: noop,
|
13 | onMenuItemClick: noop,
|
14 | setItem: noop,
|
15 | };
|
16 | export const TypeaheadContext = createContext(defaultContext);
|
17 | export const useTypeaheadContext = () => useContext(TypeaheadContext);
|