MCPcopy Create free account
hub / github.com/plotly/dash / valueOrDefault

Function valueOrDefault

components/dash-core-components/src/components/Tabs.tsx:128–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126 }, [children]);
127
128 const valueOrDefault = (): string | undefined => {
129 if (has('value', props)) {
130 return props.value;
131 }
132 const children = parseChildrenToArray();
133 if (children && children.length && children[0].props.componentPath) {
134 const firstChildren: TabProps = window.dash_component_api.getLayout(
135 [...children[0].props.componentPath, 'props']
136 );
137 return firstChildren.value ?? 'tab-1';
138 }
139 return 'tab-1';
140 };
141
142 // Initialize value on mount if not set
143 useEffect(() => {

Callers 1

TabsFunction · 0.85

Calls 2

getLayoutMethod · 0.80
hasFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…