Capacitor Plugin Callback with React? useState does nothing, can't call useEffect


I’m trying to do a simple icon color change in my plugin callback, but nothing happens with setX from my useState function. Trying to call useEffect cannot happen in a Rect hook (to force a render update) so I’m puzzled on how to accomplish this simple use case.

const TabX React.FC = (props) => {
  const [xIconColor, setXIconColor] = useState('medium');

  (CapacitorBinder as any).addListener('eventX', (info: any) => {
    console.log("Event X")

  (CapacitorBinder as any).addListener('eventY', (info: any) => {
    console.log("Event Y")



Trying to call useEffect results in React Hook “useEffect” cannot be called inside a callback…

Any advice?

This ended up being <StrictMode> wrapping the <App>

So the example created index.tsx with StrictMode, yet StrictMode breaks a simple state update.

Wonderful. :lying_face: