DEV Community

Cover image for Diving into React and Redux Toolkit: A Comprehensive Glossary of Key Terms and Concepts
Madhavi Gaikwad
Madhavi Gaikwad

Posted on

Diving into React and Redux Toolkit: A Comprehensive Glossary of Key Terms and Concepts

Diving into React: A Comprehensive Glossary of Key Terms and Concepts

React is a powerful JavaScript library that has revolutionized the way we build user interfaces. Whether you're a beginner looking to learn the basics or an experienced developer wanting to brush up on your knowledge, this article will serve as your guide to understanding the fundamental terms and concepts in React.

1. Introduction to React

React is a JavaScript library developed by Facebook for building user interfaces. It introduces a component-based architecture that allows you to create reusable, modular UI elements.

2. JSX (JavaScript XML)

JSX is a syntax extension that enables you to write HTML-like code within your JavaScript. It's a core part of React and allows you to define the structure of your components in a more intuitive way.

3. Functional Components

Functional components are the building blocks of a React application. They are defined using JavaScript functions and are the preferred way of creating components due to their simplicity and reusability.

Example:

function Greeting(props) {
  return <h1>Hello, {props.name}!</h1>;
}
Enter fullscreen mode Exit fullscreen mode

4. Class Components

Class components are another way to create components in React. They are defined using ES6 classes and have the capability to use lifecycle methods for managing component behavior.

Example:

class Counter extends React.Component {
  constructor(props) {
    super(props);
    this.state = { count: 0 };
  }

  render() {
    return (
      <div>
        <p>Count: {this.state.count}</p>
        <button onClick={() => this.setState({ count: this.state.count + 1 })}>
          Increment
        </button>
      </div>
    );
  }
}
Enter fullscreen mode Exit fullscreen mode

5. State and State Hook (useState)

State represents the internal data of a component. The useState hook is used to add state management to functional components. It returns the current state value and a function to update it.

Example:

import React, { useState } from 'react';

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

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>Increment</button>
    </div>
  );
}
Enter fullscreen mode Exit fullscreen mode

6. Effect Hook (useEffect)

The useEffect hook manages side effects in functional components, such as data fetching or DOM manipulation. It runs after rendering and can handle cleanup.

Example:

import React, { useState, useEffect } from 'react';

function Timer() {
  const [seconds, setSeconds] = useState(0);

  useEffect(() => {
    const interval = setInterval(() => {
      setSeconds(seconds + 1);
    }, 1000);

    return () => clearInterval(interval);
  }, [seconds]);

  return <p>Seconds: {seconds}</p>;
}
Enter fullscreen mode Exit fullscreen mode

7. Props and Prop Drilling

Props (short for properties) are inputs passed to components. They allow data to be passed from parent to child components. Prop drilling occurs when props are passed through multiple layers of components.

Example:

function Welcome(props) {
  return <p>Welcome, {props.name}!</p>;
}

// Usage
<Welcome name="Alice" />;
Enter fullscreen mode Exit fullscreen mode

8. Context API and Context Provider

The Context API provides a way to share state across components without prop drilling. The ContextProvider component wraps its children, and the useContext hook is used to consume context data.

Example:

const MyContext = React.createContext();

function ParentComponent() {
  return (
    <MyContext.Provider value="Hello from Context">
      <ChildComponent />
    </MyContext.Provider>
  );
}

function ChildComponent() {
  const contextValue = React.useContext(MyContext);
  return <p>{contextValue}</p>;
}
Enter fullscreen mode Exit fullscreen mode

9. Component Composition

Component composition involves creating larger components by combining smaller ones. This helps in building modular, maintainable, and reusable code.

10. Conditional Rendering

Conditional rendering allows you to display different components or content based on certain conditions. This is achieved using conditional statements in your JSX.

Example:

function Greeting(props) {
  if (props.isLoggedIn) {
    return <h1>Welcome back!</h1>;
  } else {
    return <h1>Please log in.</h1>;
  }
}
Enter fullscreen mode Exit fullscreen mode

11. Immutability

Immutability is a concept where data is not changed directly, but new data is produced. This is crucial for predictable state changes and efficient rendering.

12. Server-Side Rendering (SSR) and Client-Side Rendering (CSR)

SSR involves rendering React components on the server and sending the HTML to the client, while CSR renders components on the client side using JavaScript after downloading the initial HTML and JavaScript bundle.

13. React Element

A React element is a fundamental building block of a React application. It represents a virtual description of what should be rendered on the screen. React elements are plain JavaScript objects that describe the structure and properties of a UI component. They are lightweight and immutable.

const element = <h1>Hello, React!</h1>;
Enter fullscreen mode Exit fullscreen mode

In this example, the <h1>Hello, React!</h1> JSX expression represents a React element. When rendered, it will display an HTML heading with the text "Hello, React!" on the screen. React elements can represent various types of components, including HTML elements, custom components, or even entire user interfaces.

14. Memoization

Memoization is a technique of caching the results of expensive function calls to improve performance by avoiding unnecessary recalculations.

15. Lazy Loading

Lazy loading involves loading components, resources, or routes only when they are needed, reducing initial loading times.

16. Error Boundaries

Error boundaries are components used to catch and handle errors that occur during rendering in their child component trees, preventing application crashes.

17. Context Consumer

A component that subscribes to a context and receives the data provided by a context provider.

18. Render Prop

A technique for sharing code between components by passing a function as a prop, allowing dynamic behavior customization.

19. Hooks

Hooks are functions introduced in React 16.8 to add state and other features to functional components, reducing the need for class components.

20. Higher-Order Component (HOC)

A higher-order component is a function that takes a component and returns an enhanced component, often used for code reuse and sharing logic.

21. PropTypes

PropTypes is a utility used to specify the expected types of props for a component, catching potential type-related errors during development.

22. Default Props

Default props are values assigned to props if they're not provided by the parent component.

23. Strict Mode

Strict Mode is a development mode that detects potential problems and warnings in a React application, aiding in identifying and fixing issues early.

24. Unidirectional Data Flow

Unidirectional Data Flow is the principle that data in a React application flows in a single direction, enhancing predictability and debugging.

25. Virtual DOM

The Virtual DOM is a lightweight in-memory representation of the actual DOM, used for performance optimization by minimizing direct DOM updates.

26. UI Components

UI components are the building blocks of your user interface. They are responsible for rendering the visible parts of your application.

27. Application State

The application state refers to the overall state of your application. It encompasses data that affects multiple parts of your UI and is often managed using state management libraries like Redux or MobX.

28. Lazy Loading

Lazy loading is a technique used to load certain parts of your application only when they are needed. This can significantly improve initial loading times and the overall performance of your app.

29. Pure Component

A pure component is a class component that optimizes rendering by preventing unnecessary updates when the props and state have not changed.

30. Key Prop

The key prop is a special identifier used by React to efficiently update elements in a list. It helps React keep track of which items have changed, been added, or removed.

31. Conditional Rendering

Conditional rendering allows you to display different components or content based on certain conditions. It's a powerful tool for creating dynamic user interfaces.

32. Web Components

Web Components are a set of browser APIs that allow you to create reusable custom elements with encapsulated functionality and styling.

33. State Management

State management involves managing the data that affects a component's behavior and rendering. While React's built-in state and context API can handle simple cases, more complex applications often use dedicated state management libraries.

34. Server-Side Rendering (SSR)

Server-Side Rendering involves rendering your React components on the server and sending the pre-rendered HTML to the client. This can improve initial loading times and enhance search engine optimization (SEO).

35. Client-Side Rendering (CSR)

Client-Side Rendering renders React components on the client side using JavaScript. While it can lead to slower initial loading times, it offers a more interactive and dynamic user experience.

36. Event Handling

Event handling is crucial for creating interactive applications. React provides a streamlined way to handle user interactions, such as clicks, input changes, and keyboard events.

37. Lifecycle Methods

Lifecycle methods are special methods in class components that are called at different stages of a component's lifecycle. They allow you to perform actions at specific points, such as component mounting, updating, and unmounting.

38. Component Composition

Component composition is the practice of combining smaller, reusable components to build larger, more complex components. This encourages modularity and maintainability in your codebase.

39. Error Boundaries

Error boundaries are components that catch errors occurring in their child components during rendering. They prevent the entire application from crashing and help you provide a graceful error handling experience.

40. Container Components

Container components are components that hold the logic and state of your application. They manage data and pass it down to presentational components for rendering.

41. Presentational Components

Presentational components are focused on rendering UI elements based on the data they receive as props. They don't contain much logic and are intended to be reusable and easy to understand.

42. Higher-Order Component (HOC)

A Higher-Order Component is a function that takes a component and returns an enhanced version of that component. HOCs are used to share logic and behavior between multiple components.

43. Render Prop

A Render Prop is a technique for sharing code between components by passing a function as a prop. It allows you to encapsulate and reuse complex behavior.

44. Context Consumer

The Context Consumer is a component that subscribes to a context created by the Context Provider. It receives the data provided by the context and can access it within its rendering.

45. Context Provider

The Context Provider is a component that provides data to its child components through the context API. It establishes the context that can be consumed by context consumers.

46. Hooks

Hooks are functions introduced in React 16.8 that allow you to use state and other React features in functional components. They enable a more functional and modular coding style.

47. Static Type Checking

Static Type Checking involves using tools like TypeScript or Flow to catch type-related errors during development. This helps ensure code quality and reliability.

48. PropTypes

PropTypes is a utility that helps you specify the expected types of props for a component. It's particularly useful for catching potential type-related errors.

49. DOM

The DOM is a programming interface provided by web browsers that represents the structure of an HTML or XML document as a tree of objects. Each element, attribute, and text node in the HTML markup is represented as a node in the DOM tree. The DOM allows JavaScript to interact with and manipulate the structure and content of a web page. However, direct manipulation of the DOM can be computationally expensive, as every change triggers a reflow and repaint of the page.

50. React Component

A React component is a reusable and self-contained piece of code that encapsulates UI logic and rendering. Components are the building blocks of a React application and can be thought of as templates for creating elements

51. Form Element

A form element is an HTML element used to collect user input. In React, form elements are controlled components, meaning their values are controlled by state.

Example - Input Element:

import React, { useState } from 'react';

function LoginForm() {
  const [username, setUsername] = useState('');
  const [password, setPassword] = useState('');

  return (
    <form>
      <label>Username:</label>
      <input type="text" value={username} onChange={e => setUsername(e.target.value)} />

      <label>Password:</label>
      <input type="password" value={password} onChange={e => setPassword(e.target.value)} />

      <button type="submit">Log In</button>
    </form>
  );
}
Enter fullscreen mode Exit fullscreen mode

52. Controlled Component

A controlled component is a form element whose value is controlled by React's state. Changes to the input value are reflected in the state, making it easy to manage and synchronize with other components.

53. Form Submission

Form submission occurs when a user clicks a submit button, triggering an action. In React, you can handle form submission using the onSubmit event handler.

Example - Form Submission

function handleSubmit(event) {
  event.preventDefault();
  // Perform form submission logic here
}

function MyForm() {
  return (
    <form onSubmit={handleSubmit}>
      {/* Form elements */}
      <button type="submit">Submit</button>
    </form>
  );
}
Enter fullscreen mode Exit fullscreen mode

54. Validation

Form validation ensures that user input meets specific criteria before submission. React allows you to implement validation through state management and conditional rendering.

Example - Validation

function RegistrationForm() {
  const [username, setUsername] = useState('');
  const [email, setEmail] = useState('');
  const [isValid, setIsValid] = useState(false);

  const handleSubmit = (event) => {
    event.preventDefault();
    if (isValid) {
      // Perform registration logic
    }
  };

  return (
    <form onSubmit={handleSubmit}>
      <input
        type="text"
        value={username}
        onChange={(e) => setUsername(e.target.value)}
        placeholder="Username"
        required
      />
      <input
        type="email"
        value={email}
        onChange={(e) => setEmail(e.target.value)}
        placeholder="Email"
        required
      />
      <button type="submit" disabled={!isValid}>
        Register
      </button>
    </form>
  );
}
Enter fullscreen mode Exit fullscreen mode

55. Form Libraries

React offers various third-party libraries to simplify form handling and validation. Libraries like Formik and react-hook-form provide enhanced features and abstractions for managing forms.

56. Uncontrolled Component

An uncontrolled component is a form element whose value is managed by the DOM, rather than by React state. This is less common in React applications.

57. Formik

Formik is a popular form library for React that simplifies form handling, validation, and submission. It provides utilities to manage form state and manage validation.

58. react-hook-form

react-hook-form is another form library for React that focuses on performance and flexibility. It leverages React hooks to manage form state and validation.

59. Input Ref

An input ref allows you to directly access the DOM element of an input field. This can be useful for programmatic interactions.

Example - Input Ref:

import React, { useRef } from 'react';

function InputWithRef() {
  const inputRef = useRef(null);

  const focusInput = () => {
    inputRef.current.focus();
  };

  return (
    <div>
      <input type="text" ref={inputRef} />
      <button onClick={focusInput}>Focus Input</button>
    </div>
  );
}
Enter fullscreen mode Exit fullscreen mode

60. Custom Validation

React provides a flexible way to implement custom validation logic by using conditions and state.

Example - Custom Validation:

function CustomValidationForm() {
  const [email, setEmail] = useState('');
  const [isValidEmail, setIsValidEmail] = useState(true);

  const handleEmailChange = (event) => {
    const newEmail = event.target.value;
    setEmail(newEmail);
    setIsValidEmail(validateEmail(newEmail));
  };

  const validateEmail = (email) => {
    // Custom email validation logic
    return email.includes('@');
  };

  return (
    <form>
      <input
        type="text"
        value={email}
        onChange={handleEmailChange}
        className={isValidEmail ? 'valid' : 'invalid'}
      />
      <button type="submit">Submit</button>
    </form>
  );
}
Enter fullscreen mode Exit fullscreen mode

61. RTK (Redux Toolkit)

Redux Toolkit is an official set of tools and libraries provided by the Redux team to simplify common Redux use cases and improve developer productivity.

62. createSlice

createSlice is a function from Redux Toolkit that generates a slice of Redux state, along with the associated reducer and action creators. It helps reduce boilerplate code.

63. configureStore

configureStore is a function from Redux Toolkit that simplifies the process of creating a Redux store. It includes built-in middleware and other optimizations.

64. createAsyncThunk

createAsyncThunk is a utility function in Redux Toolkit that generates async action creators. It's commonly used for handling asynchronous operations like API requests.

65. createEntityAdapter

createEntityAdapter is a utility from Redux Toolkit that simplifies managing normalized data in the store. It provides useful functions for CRUD operations on entities.

66. immer Integration

Redux Toolkit integrates the immer library for creating reducers that work with immutable updates using a simpler syntax.

67. Normalized State

Redux Toolkit encourages using normalized state structures, where data is stored in a flat structure with relationships defined by IDs. This improves performance and organization.

68. Selector Functions

Redux Toolkit provides createSlice with built-in support for creating selector functions that efficiently extract data from the store.

69. Thunks by Default

Redux Toolkit encourages using thunks for handling asynchronous actions, and it configures the store to work seamlessly with async actions.

70. Redux DevTools Extension

Redux Toolkit integrates with the Redux DevTools browser extension to provide enhanced debugging capabilities for Redux applications.

71. Normalized Data

Redux Toolkit's createEntityAdapter helps in managing normalized data, where entities are stored in an organized way using IDs to link relationships.

72. Redundant Action Types

Redux Toolkit eliminates the need for manually defining action types by generating them automatically when using createSlice and async action creators.

73. Type-safe Actions

Redux Toolkit generates type-safe action creators and reducers, reducing the risk of errors caused by mismatched action types.

74. Middleware Configuration

Redux Toolkit's configureStore function includes built-in middleware for handling common use cases, making store setup simpler.

75. One-Line Reducer Logic

With Redux Toolkit, you can often define reducer logic in a single line of code, reducing boilerplate and making reducers more concise.

76. State Management Simplification

Redux Toolkit's utilities and conventions simplify the process of managing state in a Redux application, reducing the learning curve and improving productivity.

77. Immutability Made Easy

Redux Toolkit, by integrating with immer, makes it easier to work with immutable updates, reducing the complexity of updating state.

78. Redux Toolkit Query

Redux Toolkit Query is an additional package that provides powerful data fetching and caching capabilities, integrating seamlessly with Redux Toolkit.

79. Structured Redux Setup

Redux Toolkit enforces a structured setup for Redux applications, making it easier to organize actions, reducers, and selectors in a consistent manner.


In conclusion, this comprehensive glossary has taken you on a journey through the fundamental terms and concepts of React and Redux Toolkit. From JSX and functional components to Redux Toolkit's createSlice and normalized data handling, you now possess a solid foundation to navigate these powerful technologies with confidence. Whether you're a newcomer or an experienced developer, this glossary equips you with the knowledge needed to build engaging web applications and harness the full potential of React and Redux Toolkit.
Happy coding!


Top comments (0)