0

Hi i am trying to console one state variable and i get this as output console

enter image description here

I am not able to understand what does this mean, it shows array of length two but when i click it, it is undefined

There are many console so underlined console output are from same line in different re render. It is consoled every frame update using

this is my code

useLayoutEffect(() => {
    context.onRender = (renderState: RenderState, done) => {
      setRenderDone(() => done);
      setTopics(renderState.topics);
      setMessages(renderState.currentFrame);
      console.log("message is", renderState);
    };

    context.watch("topics");
    context.watch("currentFrame");

    context.subscribe(["mouse"]);
  }, [context]);

is this some behaviour of inspection tool or anything

Pravin Poudel
  • 1,433
  • 3
  • 16
  • 38
  • It means that some code (which you haven't shown, and which might not even be your own) is modifying the `renderState` object after you logged it (but before you inspected it), and assigns `renderState.currentFrame = undefined`. – Bergi Jun 15 '23 at 22:44
  • what does "which might not even be your own" means ? – Pravin Poudel Jun 15 '23 at 22:50
  • That it might be the code of a library that you are using – Bergi Jun 16 '23 at 05:23

0 Answers0