Added shared grid context and moved away from calling useContext directly
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from "react";
|
||||
import React, { useState, useContext } from "react";
|
||||
|
||||
const DiceLoadingContext = React.createContext();
|
||||
|
||||
@@ -28,4 +28,12 @@ export function DiceLoadingProvider({ children }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function useDiceLoading() {
|
||||
const context = useContext(DiceLoadingContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useDiceLoading must be used within a DiceLoadingProvider");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
export default DiceLoadingContext;
|
||||
|
||||
Reference in New Issue
Block a user