import React, { useState } from 'react';
import App from './App';

const OpenCvButton = () => {
    var istrue = false;
  const [showApp, setShowApp1] = useState(false);

  const handleClick = () => {
    console.log("Button clicked, setting showApp to true",showApp);
    //const savedShowApp = localStorage.getItem('showApp') === 'true';
     setShowApp1(true);
   // setShowApp1(prevState => !prevState); // Toggle the state for better debugging
   // console.log('Button clicked, showChild:', ShowApp); // Log to verify state change

    console.log("Button clicked, setting showApp to true1",showApp);

  };

  return (
    <div>
      {!showApp ?  <button onClick={handleClick}> Initialize OpenCV </button> : <> <App /> <App /> </>}


     {/* if(!showApp){ <button onClick={handleClick}>
          Initialize OpenCV
        </button>}
        else{
             <App />
        } */}

  
    </div>
  );
};

export default OpenCvButton;
