score:0

const Component2 = (props) => {
 if(props.data === ""){
 return(<div></div>)
}
    return (
        <div className="main-cointainer">
            <h2>Compnent2</h2> 
              
<p>{props.data} </p>
  
        </div>
    )
}
  
export default Component2;

score:0

const Component2 =({ data, hidden }) => {
  return (
    <div hidden={hidden}>
      <h1>Component2</h1>
    </div>
  );
}

score:1

import React from "react";
import "./style.css";

import Component2 from "./Component2";

export default function App() {
  return (
    <div>
      <h1>Hello StackBlitz!</h1>
      <p>Start editing to see some magic happen :)</p>
      <div style={{ display: "none" }}>
        <Component2 myProps="this is a example" />
      </div>
    </div>
  );
}
  

Related Query

More Query from same tag