MCPcopy Create free account
hub / github.com/effector/effector / RenderComponent

Function RenderComponent

src/react/createComponent.ts:31–43  ·  view source on GitHub ↗
(props: Props)

Source from the content-addressed store, hash-verified

29 const unmounted = createEvent<any>()
30
31 function RenderComponent(props: Props) {
32 const propsRef = React.useRef(props)
33 const state = useStore(store)
34 useIsomorphicLayoutEffect(() => {
35 mounted({props: propsRef.current, state: store.getState()})
36 return () => {
37 unmounted({props: propsRef.current, state: store.getState()})
38 }
39 }, [])
40 const result = renderProp(props, state)
41 propsRef.current = props
42 return result
43 }
44 RenderComponent.mounted = mounted
45 RenderComponent.unmounted = unmounted
46 return withDisplayName(`${storeName}.View`, RenderComponent)

Callers

nothing calls this directly

Calls 2

useStoreFunction · 0.90
getStateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…