Prevent double rendering in strict mode
The double invocation during dev mode, while harmless, is confusing, so add an additional small check to insure this only runs once.
This commit is contained in:
parent
712b99b8f3
commit
608cb6c85e
|
@ -1,12 +1,15 @@
|
|||
import React, { useEffect } from "react";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { Container } from "./components/Container";
|
||||
import { parseAndHandleRequest } from "./services/billing-service";
|
||||
import S from "./utils/strings";
|
||||
|
||||
export const App: React.FC = () => {
|
||||
const [failed, setFailed] = React.useState(false);
|
||||
const [failed, setFailed] = useState(false);
|
||||
const once = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (once.current) return;
|
||||
once.current = true;
|
||||
parseAndHandleRequest().catch(() => {
|
||||
setFailed(true);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue