Home / Function/ ComponentSearchInput() — react Function Reference

ComponentSearchInput() — react Function Reference

Architecture documentation for the ComponentSearchInput() function in ComponentSearchInput.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  1051a6ca_3da8_e140_bc43_b94256bcee15["ComponentSearchInput()"]
  ad6b058b_c5bb_8fa4_9174_b36bde9c7ec6["ComponentSearchInput.js"]
  1051a6ca_3da8_e140_bc43_b94256bcee15 -->|defined in| ad6b058b_c5bb_8fa4_9174_b36bde9c7ec6
  style 1051a6ca_3da8_e140_bc43_b94256bcee15 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/devtools/views/Components/ComponentSearchInput.js lines 19–52

export default function ComponentSearchInput(): React.Node {
  const [localSearchQuery, setLocalSearchQuery] = useState('');
  const {searchIndex, searchResults} = useContext(TreeStateContext);
  const transitionDispatch = useContext(TreeDispatcherContext);

  const search = useCallback(
    (text: string) => {
      setLocalSearchQuery(text);
      transitionDispatch({type: 'SET_SEARCH_TEXT', payload: text});
    },
    [setLocalSearchQuery, transitionDispatch],
  );
  const goToNextResult = useCallback(
    () => transitionDispatch({type: 'GO_TO_NEXT_SEARCH_RESULT'}),
    [transitionDispatch],
  );
  const goToPreviousResult = useCallback(
    () => transitionDispatch({type: 'GO_TO_PREVIOUS_SEARCH_RESULT'}),
    [transitionDispatch],
  );

  return (
    <SearchInput
      goToNextResult={goToNextResult}
      goToPreviousResult={goToPreviousResult}
      placeholder="Search (text or /regex/)"
      search={search}
      searchIndex={searchIndex}
      searchResultsCount={searchResults.length}
      searchText={localSearchQuery}
      testName="ComponentSearchInput"
    />
  );
}

Domain

Subdomains

Frequently Asked Questions

What does ComponentSearchInput() do?
ComponentSearchInput() is a function in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/Components/ComponentSearchInput.js.
Where is ComponentSearchInput() defined?
ComponentSearchInput() is defined in packages/react-devtools-shared/src/devtools/views/Components/ComponentSearchInput.js at line 19.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free