Fix context use

This commit is contained in:
Willian Mitsuda 2021-07-09 14:22:25 -03:00
parent 052b2f61e0
commit 7b2bdce210
2 changed files with 6 additions and 6 deletions

View File

@ -1,13 +1,13 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect, useContext } from "react";
import { fourBytesURL } from "../url"; import { fourBytesURL } from "../url";
import { useRuntime } from "../useRuntime"; import { RuntimeContext } from "../useRuntime";
type MethodNameProps = { type MethodNameProps = {
data: string; data: string;
}; };
const MethodName: React.FC<MethodNameProps> = ({ data }) => { const MethodName: React.FC<MethodNameProps> = ({ data }) => {
const runtime = useRuntime(); const runtime = useContext(RuntimeContext);
const [name, setName] = useState<string>(); const [name, setName] = useState<string>();
useEffect(() => { useEffect(() => {

View File

@ -1,7 +1,7 @@
import React, { Suspense } from "react"; import React, { Suspense, useContext } from "react";
import { useImage } from "react-image"; import { useImage } from "react-image";
import { tokenLogoURL } from "../url"; import { tokenLogoURL } from "../url";
import { useRuntime } from "../useRuntime"; import { RuntimeContext } from "../useRuntime";
type TokenLogoProps = { type TokenLogoProps = {
address: string; address: string;
@ -15,7 +15,7 @@ const TokenLogo: React.FC<TokenLogoProps> = (props) => (
); );
const InternalTokenLogo: React.FC<TokenLogoProps> = ({ address, name }) => { const InternalTokenLogo: React.FC<TokenLogoProps> = ({ address, name }) => {
const { config } = useRuntime(); const { config } = useContext(RuntimeContext);
const srcList: string[] = []; const srcList: string[] = [];
if (config) { if (config) {