-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathApp.js
35 lines (33 loc) · 854 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import React, { useState } from "react";
import "./App.css";
import PartA from "./prob/PartA";
import PartB from "./prob/PartB";
function App() {
const [showB, setShowB] = useState(false);
const [isHidden, setIsHidden] = useState(false);
return (
<>
<div className="container text-center">
<button
className="bg-blue-200 rounded p-1"
onClick={() => setShowB(state => !state)}
>
Switch A/B
</button>
<button
className="bg-gray-200 rounded p-1 ml-2"
onClick={() => setIsHidden(state => !state)}
>
Hide/Show
</button>
</div>
{!isHidden && (
<div className="App" style={{ height: "95%" }}>
{!showB && <PartA />}
{showB && <PartB />}
</div>
)}
</>
);
}
export default App;