0

Declartion problem

I have this code in react js Const( A,B,C,D) The problem is that every variable is colored with the color yellow except C is bule Although every variable has been declared and sent a value to it Im using vs code btw

11th Dec 2022, 7:08 AM
MANAYER .
4 ответов
+ 5
It seems like you are encountering a syntax error in your code. In JavaScript (and therefore also in React), the const keyword is used to declare a variable with a constant value. However, in your code, you have used the const keyword followed by a set of variables in parentheses. This is not valid syntax. To correctly declare multiple variables with the const keyword in React, you would need to write something like this: const A = someValue; const B = someOtherValue; const C = yetAnotherValue; const D = oneMoreValue; In this code, each variable is declared on its own line, and is assigned a value using the = operator. You can then use these variables in your React component as needed.
11th Dec 2022, 9:19 AM
Sadaam Linux
Sadaam Linux - avatar
+ 5
Additionally, it is not clear what you mean when you say that the variables are colored with different colors. In general, the color of text in a code editor does not affect the functionality of the code itself, and is only used to help the programmer visually distinguish different types of syntax. It is possible that your code editor is highlighting the variables in different colors to indicate a syntax error, but without more information it is difficult to say for sure.
11th Dec 2022, 9:19 AM
Sadaam Linux
Sadaam Linux - avatar
0
I used set of variables cuz they all require the same value which is a file then i used them in a loop
11th Dec 2022, 12:45 PM
MANAYER .
0
What i meant is that they all have the same syntax why only one of them is colored diffrently ? cuz when run them they all seem to work except C
11th Dec 2022, 12:48 PM
MANAYER .