File tree 3 files changed +6
-17
lines changed
packages/victory-core/src/victory-state
3 files changed +6
-17
lines changed Original file line number Diff line number Diff line change 120
120
"ts-jest" : " ^28.0.3" ,
121
121
"ts-loader" : " ^9.3.0" ,
122
122
"typescript" : " ^4.7.3" ,
123
- "use-context-selector" : " ^1.4.1" ,
124
123
"webpack" : " ^5.72.1" ,
125
124
"webpack-cli" : " ^4.9.2" ,
126
125
"webpack-dev-server" : " ^4.9.0" ,
Original file line number Diff line number Diff line change 1
1
import * as React from "react" ;
2
- import { createContext , useContextSelector } from "use-context-selector " ;
2
+ import { createContext , useContext } from "react " ;
3
3
import { D3ScaleFn , DomainTuple , ForAxes } from "../types/prop-types" ;
4
4
import { FormattedDatum , getData } from "./helpers/get-data" ;
5
5
import { getDomain } from "./helpers/get-domain" ;
@@ -81,17 +81,12 @@ export function VictoryProvider({
81
81
) ;
82
82
}
83
83
84
- type ContextValue = ContextType | null ;
85
-
86
84
export function useVictoryContext < T > ( selector : ( value : ContextType ) => T ) : T {
87
- return useContextSelector < ContextValue , T > ( VictoryContext , ( context ) => {
88
- if ( ! context ) {
89
- throw new Error (
90
- "useVictoryContext must be used within a VictoryProvider" ,
91
- ) ;
92
- }
93
- return selector ( context ) ;
94
- } ) ;
85
+ const context = useContext ( VictoryContext ) ;
86
+ if ( ! context ) {
87
+ throw new Error ( "useVictoryContext must be used within a VictoryProvider" ) ;
88
+ }
89
+ return selector ( context ) ;
95
90
}
96
91
97
92
export function useScale ( ) {
Original file line number Diff line number Diff line change @@ -17593,11 +17593,6 @@ url@^0.11.0:
17593
17593
punycode "1.3.2"
17594
17594
querystring "0.2.0"
17595
17595
17596
- use-context-selector@^1.4.1:
17597
- version "1.4.1"
17598
- resolved "https://registry.yarnpkg.com/use-context-selector/-/use-context-selector-1.4.1.tgz#eb96279965846b72915d7f899b8e6ef1d768b0ae"
17599
- integrity sha512-Io2ArvcRO+6MWIhkdfMFt+WKQX+Vb++W8DS2l03z/Vw/rz3BclKpM0ynr4LYGyU85Eke+Yx5oIhTY++QR0ZDoA==
17600
-
17601
17596
use-subscription@^1.0.0:
17602
17597
version "1.7.0"
17603
17598
resolved "https://registry.yarnpkg.com/use-subscription/-/use-subscription-1.7.0.tgz#c7505263315deac9fd2581cdf4ab1e3ff2585d0f"
You can’t perform that action at this time.
0 commit comments