ReactJS leverages many ES6 (ECMAScript 2015) features to write cleaner, more concise, and maintainable code. Here are some of the most commonly used ES6 features in React:

1. Classes

Example

class Product extends React.Component {
  render() {
    return (
      <div>
        <h1>{this.props.name}</h1>
        <p>{this.props.price}</p>
      </div>
    );
  }
}

2. Arrow Functions

Example

const handleClick = () => {
  console.log("Button clicked!");
};

3. Destructuring

Example

const product = { name: "Shirt", price: 25 };
const { name, price } = product; // Destructure name and price properties
console.log(name, price); // Output: Shirt 25

4. Template Literals (Backticks)

Example

const name = "Alice";
const greeting = `Hello, ${name}!`;
console.log(greeting); // Output: Hello, Alice!

5. Spread Operator (...)

Example

const numbers = [1, 2, 3];
const copy = [...numbers]; // Create a copy of the numbers array
const combined = [...numbers, 4, 5]; // Combine arrays

6. Default Parameters

Example

const greet = (name = "World") => `Hello, ${name}!`;

console.log(greet()); // Output: Hello, World!
console.log(greet("Bob")); // Output: Hello, Bob!

7. Imports and Exports

Example

// In a file named Product.js:
export default Product; // Export the Product component

// In another file where you want to use the Product component:
import Product from './Product'; // Import the Product component

By effectively utilizing these ES6 features, you can write more efficient, readable, and maintainable React components, improving the overall quality and developer experience of your React applications.