Added shared grid context and moved away from calling useContext directly
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import React, { useState, useContext } from "react";
|
||||
import React, { useState } from "react";
|
||||
import { IconButton } from "theme-ui";
|
||||
|
||||
import SelectMapModal from "../../modals/SelectMapModal";
|
||||
import SelectMapIcon from "../../icons/SelectMapIcon";
|
||||
|
||||
import MapDataContext from "../../contexts/MapDataContext";
|
||||
import AuthContext from "../../contexts/AuthContext";
|
||||
import { useMapData } from "../../contexts/MapDataContext";
|
||||
import { useAuth } from "../../contexts/AuthContext";
|
||||
|
||||
function SelectMapButton({
|
||||
onMapChange,
|
||||
@@ -16,8 +16,8 @@ function SelectMapButton({
|
||||
}) {
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
|
||||
const { updateMapState } = useContext(MapDataContext);
|
||||
const { userId } = useContext(AuthContext);
|
||||
const { updateMapState } = useMapData();
|
||||
const { userId } = useAuth();
|
||||
function openModal() {
|
||||
if (currentMapState && currentMap && currentMap.owner === userId) {
|
||||
updateMapState(currentMapState.mapId, currentMapState);
|
||||
|
||||
Reference in New Issue
Block a user