MCPcopy Index your code
hub / github.com/JedWatson/react-select / applyPrefixToName

Function applyPrefixToName

packages/react-select/src/utils.ts:34–42  ·  view source on GitHub ↗

String representation of component state for styling with class names. Expects an array of strings OR a string/object pair: - className(['comp', 'comp-arg', 'comp-arg-2']) @returns 'react-select__comp react-select__comp-arg react-select__comp-arg-2' - className('comp', { some: true, state: fa

(prefix: string, name: string)

Source from the content-addressed store, hash-verified

32 @returns 'react-select__comp react-select__comp--some'
33*/
34function applyPrefixToName(prefix: string, name: string) {
35 if (!name) {
36 return prefix;
37 } else if (name[0] === '-') {
38 return prefix + name;
39 } else {
40 return prefix + '__' + name;
41 }
42}
43
44export function classNames(
45 prefix?: string | null,

Callers 1

classNamesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…