Extract title into effect

This commit is contained in:
Willian Mitsuda 2022-08-24 04:44:18 -03:00
parent 66d6ccae10
commit 32a93e211f
No known key found for this signature in database
2 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import React, { useContext } from "react";
import React, { useContext, useEffect } from "react";
import { useParams, Route, Routes } from "react-router-dom";
import { Tab } from "@headlessui/react";
import StandardFrame from "./StandardFrame";
@ -25,6 +25,12 @@ const Transaction: React.FC = () => {
const txData = useTxData(provider, txHash);
const selectionCtx = useSelection();
useEffect(() => {
if (txData) {
document.title = `Transaction ${txData.transactionHash} | Otterscan`;
}
}, [txData]);
return (
<SelectedTransactionContext.Provider value={txData}>
<BlockNumberContext.Provider value={txData?.confirmedData?.blockNumber}>

View File

@ -207,8 +207,6 @@ export const useTxData = (
return;
}
document.title = `Transaction ${_response.hash} | Otterscan`;
setTxData({
transactionHash: _response.hash,
from: _response.from,