Skip to content

Commit

Permalink
chore: callback's setter logic changed (setState removed)
Browse files Browse the repository at this point in the history
  • Loading branch information
FulbertoDev committed Mar 22, 2024
1 parent 3a22ce2 commit 7ac940c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/kkiapay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ const WIDGET_URI = 'https://widget-v3.kkiapay.me?';
export function KkiapayProvider({ children }: PropsWithChildren<any>) {
const [widgetOpened, isWidgetOpened] = useState(false);
const [uri, setUri] = useState(WIDGET_URI);
const [callbacks, setCallbacks] = useState<Record<string, any>>({});
const [callbacks] = useState<Record<string, any>>({});
const defaultEvent = useRef<DefaultEventListener>(() => {});

function registerCallback<T>(name: ListenerEventName, cb: T) {
setCallbacks((callbacks) => ({ ...callbacks, [name]: cb }));
callbacks[name] = cb;
//setCallbacks((callbacks) => ({ ...callbacks, [name]: cb }));
}

const openKkiapayWidget = (config: IData) => {
Expand Down

0 comments on commit 7ac940c

Please sign in to comment.