1

variable populated through useSelector (redux) displaying null instead of actual value when accessing through button handler. when using the class-based approach it works fine:

import React from "react";

import { useSelector } from "react-redux";
import { Button } from "@sencha/ext-react-modern";

const LoadButton = () => {
  const viewer = useSelector((state) => state.bim._viewer);

  const handleSenchaBtn = () => {
    console.log("sencha button", viewer);
  };
  const handleHtmlBtn = () => {
    console.log("html button", viewer);
  };
  return (
    <>
      <button onClick={handleHtmlBtn}>Normal Button</button>
      <Button text="Sencha Button" ui="action" handler={handleSenchaBtn} />
    </>
  );
};

export default LoadButton;

Console logs of button actions:

Console logs

Jose Lora
  • 1,392
  • 4
  • 12
  • 18

0 Answers0