-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(datagrid): exports FilterContext (#3067)
* feat(datagrid): exports FilterContext * fix: changes the export to custom hook * fix: removed duplicate import that broke build
- Loading branch information
1 parent
8fb7c59
commit 31d0989
Showing
5 changed files
with
38 additions
and
18 deletions.
There are no files selected for viewing
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
16 changes: 16 additions & 0 deletions
16
.../ibm-products/src/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { FilterContext } from '../FilterProvider'; | ||
import { useContext } from 'react'; | ||
|
||
const useFilterContext = () => { | ||
// get the context | ||
const context = useContext(FilterContext); | ||
|
||
// if `undefined`, throw an error | ||
if (context === undefined) { | ||
throw new Error('useFilterContext was used outside of its Provider'); | ||
} | ||
|
||
return context; | ||
}; | ||
|
||
export default useFilterContext; |
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
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
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