mdoTomofumi Chiba
2/5/2024, 9:44:21 AM

HTML, React: DOMは存在させたいが非表示にさせたい

const [visible, setVisible] = useState(false);
// :
return (
  <div style={visible ? undefined : { visibility: "hidden", height: 0 }}>
    Hello
  </div>
);
TweetBlueskyLike