'randomNumber' is never reassigned. Use 'const' instead.
9 // let randomNumber = useMemo(() => {
10 // return Math.floor(Math.random() * 37) % 12;
11 // }, []);
12 let randomNumber = 9; 13
14 const fetchHandler = useCallback(async () => {
15 setIsLoading(true);
'trender' is never reassigned. Use 'const' instead.
44 fetchHandler();
45 }, [fetchHandler]);
46
47 let trender = "this is trender"; 48
49 const APIContextValues = {
50 trendingApiData: apiData,
'randomNumber' is never reassigned. Use 'const' instead.
9 // let randomNumber = useMemo(() => {
10 // return Math.floor(Math.random() * 37) % 12;
11 // }, []);
12 let randomNumber = 10; 13
14 const fetchHandler = useCallback(async () => {
15 setIsLoading(true);
'randomNumber' is never reassigned. Use 'const' instead.
9 // let randomNumber = useMemo(() => {
10 // return Math.floor(Math.random() * 37) % 12;
11 // }, []);
12 let randomNumber = 12; 13
14 const fetchHandler = useCallback(async () => {
15 setIsLoading(true);
'randomNumber' is never reassigned. Use 'const' instead.
9 // let randomNumber = useMemo(() => {
10 // return Math.floor(Math.random() * 37) % 12;
11 // }, []);
12 let randomNumber = 20; 13
14 const fetchHandler = useCallback(async () => {
15 setIsLoading(true);
'actioneer' is never reassigned. Use 'const' instead.
44 fetchHandler();
45 }, [fetchHandler]);
46
47 let actioneer = "this is actioneer"; 48
49 const APIContextValues = {
50 actionApiData: apiData,
Description
Variables that are never re-assigned a new value after their initial declaration should be declared with the const
keyword.
This prevents the programmer from erroneously re-assigning to a read-only variable, and informs those reading the code that a variable is a constant value.
Bad Practice
let pi = Math.PI
for (let x of xs) {
use(x);
}
let { a, b } = object;
use(a, b);
Recommended
const pi = Math.PI
for (const x of xs) {
use(x);
}
const { a, b } = object;
use(a, b);