mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-16 08:08:56 -05:00
refactor: named imports vs default
addresses comment from @veganbeef
This commit is contained in:
parent
fab3ce9a10
commit
a39cb6a0da
@ -1,4 +1,4 @@
|
|||||||
import * as React from "react";
|
import React, { createContext, useEffect, useState } from "react";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { sdk } from '@farcaster/frame-sdk';
|
import { sdk } from '@farcaster/frame-sdk';
|
||||||
|
|
||||||
@ -12,14 +12,14 @@ type SafeFarcasterSolanaProviderProps = {
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SolanaProviderContext = React.createContext<{ hasSolanaProvider: boolean }>({ hasSolanaProvider: false });
|
const SolanaProviderContext = createContext<{ hasSolanaProvider: boolean }>({ hasSolanaProvider: false });
|
||||||
|
|
||||||
export function SafeFarcasterSolanaProvider({ endpoint, children }: SafeFarcasterSolanaProviderProps) {
|
export function SafeFarcasterSolanaProvider({ endpoint, children }: SafeFarcasterSolanaProviderProps) {
|
||||||
const isClient = typeof window !== "undefined";
|
const isClient = typeof window !== "undefined";
|
||||||
const [hasSolanaProvider, setHasSolanaProvider] = React.useState<boolean>(false);
|
const [hasSolanaProvider, setHasSolanaProvider] = useState<boolean>(false);
|
||||||
const [checked, setChecked] = React.useState<boolean>(false);
|
const [checked, setChecked] = useState<boolean>(false);
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isClient) return;
|
if (!isClient) return;
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
(async () => {
|
(async () => {
|
||||||
@ -43,7 +43,7 @@ export function SafeFarcasterSolanaProvider({ endpoint, children }: SafeFarcaste
|
|||||||
};
|
};
|
||||||
}, [isClient]);
|
}, [isClient]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
let errorShown = false;
|
let errorShown = false;
|
||||||
const origError = console.error;
|
const origError = console.error;
|
||||||
console.error = (...args) => {
|
console.error = (...args) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user