MCPcopy Create free account
hub / github.com/coderarmy-notes/mern-stack-course / App

Function App

04React/Day07/vite-project/src/App.jsx:5–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import Post from './Post';
4
5function App() {
6 const [count, setCount] = useState(0);
7 const [number,setNumber] = useState(100000);
8
9 // function calculatePrime(){
10
11 // let total = 0;
12
13 // if(number>1)
14 // total++;
15
16 // for(let i=3;i<=number;i++){
17 // total++;
18 // for(let j=2;j<i;j++){
19 // if(i%j==0){
20 // total--;
21 // break;
22 // }
23 // }
24 // }
25
26 // return total;
27
28 // }
29
30 // function handleClick(){
31 // console.log("Hello Ji");
32 // }
33
34
35 const handleClick = useCallback(()=>{
36 console.log("Handle Click", count);
37 },[count]);
38
39
40
41 const prime = useMemo(()=>{
42
43 let total = 0;
44
45 if(number>1)
46 total++;
47
48 for(let i=3;i<=number;i++){
49 total++;
50 for(let j=2;j<i;j++){
51 if(i%j==0){
52 total--;
53 break;
54 }
55 }
56 }
57
58 return total;
59
60 },[number])
61
62

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected