React

A JavaScript library for building user interfaces

React Overview

React is an open-source front-end JavaScript library for building user interfaces or UI components. It is maintained by Facebook and a community of individual developers and companies. React can be used as a base in the development of single-page or mobile applications.

Initial release

May 29, 2013

Stable release

18.2.0 (June 14, 2022)

Written in

JavaScript

License

MIT License

Key Features

Common Use Cases

Single Page Applications

React is ideal for building dynamic SPAs with complex user interactions.

Progressive Web Apps

Create PWAs with React that work offline and provide app-like experiences.

Cross-Platform Mobile Apps

React Native allows building native mobile apps using React.

Interactive Dashboards

Build complex data visualization dashboards with real-time updates.

Example Code

// Functional component with hooks example
import React, { useState, useEffect } from 'react';

function Counter() {
    const [count, setCount] = useState(0);
    const [isEven, setIsEven] = useState(false);

    useEffect(() => {
        // Update isEven when count changes
        setIsEven(count % 2 === 0);
    }, [count]);

    return (
        <div className="counter">
            <h2>Counter: {count}</h2>
            <p>This number is {isEven ? 'even' : 'odd'}</p>
            <button onClick={() => setCount(count + 1)}>
                Increment
            </button>
            <button onClick={() => setCount(count - 1)}>
                Decrement
            </button>
        </div>
    );
}

export default Counter;

Learning Resources