What is the meaning of spread operator (…) in Reactjs?
The three dots syntax (…) is part of ES6 and not React itself and it’s used by two operators i.e. the Spread and Rest operators. The Spread operator lets you expand an iterable like an object, string, or array into its elements while the Rest operator does the inverse by reducing a set of elements into one array.
The spread operator is very useful when you want to make an exact copy of an existing array, you can use the spread operator to accomplish this quickly.
Creating React Application:
-
Step 1: Create a React application using the following command:
npx create-react-app foldername
-
Step 2: After creating your project folder i.e. foldername, move to it using the following command:
cd foldername
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Last Updated :
23 Dec, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...