Skip to content

[docs-scanner] Missing useState import in backend extension React example #25192

@github-actions

Description

@github-actions

File: content/manuals/extensions/extensions-sdk/build/backend-extension-tutorial.md

Issue

The React code example in the "Invoke the extension backend from your frontend" section uses the useState hook but doesn't import it, which would cause a compilation error.

The import statement (line ~240):

import React, { useEffect } from 'react';

But the code uses useState (line ~248):

const [hello, setHello] = useState<string>();

Additionally, the code declares ddClient twice - once outside the component and once inside, which is redundant:

const ddClient = createDockerDesktopClient(); // Line ~244

export function App() {
  const ddClient = createDockerDesktopClient(); // Line ~247 - redundant

Why this matters

A developer copying this code would get a compilation error: 'useState' is not defined. The code won't run until they figure out the missing import. The duplicate ddClient declaration, while not causing an error, adds confusion about the correct pattern.

Suggested fix

Update the import statement to include useState:

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

And remove the duplicate ddClient declaration inside the App function, keeping only the one outside (or vice versa, depending on the intended pattern).


Found by nightly documentation quality scanner

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions