MCPcopy Create free account
hub / github.com/Surfer-Org/Protocol / SectionProvider

Function SectionProvider

docs/src/components/SectionProvider.jsx:105–119  ·  view source on GitHub ↗
({ sections, children })

Source from the content-addressed store, hash-verified

103 typeof window === 'undefined' ? useEffect : useLayoutEffect
104
105export function SectionProvider({ sections, children }) {
106 let [sectionStore] = useState(() => createSectionStore(sections))
107
108 useVisibleSections(sectionStore)
109
110 useIsomorphicLayoutEffect(() => {
111 sectionStore.setState({ sections })
112 }, [sectionStore, sections])
113
114 return (
115 <SectionStoreContext.Provider value={sectionStore}>
116 {children}
117 </SectionStoreContext.Provider>
118 )
119}
120
121export function useSectionStore(selector) {
122 let store = useContext(SectionStoreContext)

Callers

nothing calls this directly

Calls 2

createSectionStoreFunction · 0.85
useVisibleSectionsFunction · 0.85

Tested by

no test coverage detected