Skip to content

Commit b99e432

Browse files
committed
resolved some issues
1 parent 741a752 commit b99e432

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

courses/react-js/advanced-level/component-optimization/LazyLoadingExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Suspense } from "react";
1+
import React, { Suspense } from "react";
22
const LazyComponent = React.lazy(() => import("./LazyComponent"));
33
const LazyLoadingExample = () => {
44
return (

courses/react-js/advanced-level/component-optimization/MemoizationExample.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { useMemo, useState } from "react";
1+
import React, { useMemo, useState } from "react";
22

33
const ExpensiveComponent = ({ value }) => {
44
const expensiveFunction = (value) => {
5+
// Expensive computation
56
return value * 2;
67
};
78
const memoizedValue = useMemo(() => expensiveFunction(value), [value]);

courses/react-js/begginer-level/building-your-first-react-app/MyComponent.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const MyComponent = () => {
1414
{isLoggedIn && <p>Welcome back, {name}!</p>}
1515

1616
<ul>
17-
{fruits.map((fruit) => (
18-
<li>{fruit}</li>
17+
{fruits.map((fruit, index) => (
18+
<li key={index}>{fruit}</li>
1919
))}
2020
</ul>
2121

@@ -24,6 +24,7 @@ const MyComponent = () => {
2424
);
2525
}
2626

27+
// Another component to compose
2728
const Button = ({ text, onClick }) => {
2829
return <button onClick={onClick}>{text}</button>;
2930
}

0 commit comments

Comments
 (0)