Module

Yoga.React.Om

Package
purescript-yoga-react-om
Repository
rowtype-yoga/purescript-yoga-react-om

#OmRender Source

newtype OmRender :: Row Type -> Type -> Type -> Type -> Typenewtype OmRender ctx x y a

A render context that tracks the Om context at the type level. At runtime this is identical to Render — the ctx is phantom. Use qualified-do with this module (e.g. Om.do) to compose hooks.

Instances

#omComponent Source

omComponent :: forall @ctx @err hooks props. String -> (props -> OmRender ctx Unit hooks JSX) -> Om (Record ctx) err (props -> JSX)

Create a React component with Om-based dependency injection. The context is captured once at construction time and made available to hooks via useCtx and useOm inside qualified-do blocks.

#useCtx Source

useCtx :: forall @ctx hooks. OmRender ctx hooks (UseCtx ctx hooks) (Record ctx)

Read the full Om context record inside a component.

#useOm Source

useOm :: forall @ctx hooks a. (Record ctx -> Effect a) -> OmRender ctx hooks (UseOm ctx a hooks) a

Run a synchronous Effect that has access to the Om context.

#useSignal Source

useSignal :: forall ctx hooks a. Signal a -> OmRender ctx hooks (UseSignal a hooks) a

#useEvent Source

useEvent :: forall ctx hooks a. Event a -> OmRender ctx hooks (UseEvent a hooks) (Maybe a)

#UseCtx Source

data UseCtx :: Row Type -> Type -> Typedata UseCtx ctx hooks

#UseOm Source

data UseOm :: Row Type -> Type -> Type -> Typedata UseOm ctx a hooks

#UseSignal Source

data UseSignal a hooks

#UseEvent Source

data UseEvent a hooks

#liftRender Source

liftRender :: forall ctx x y a. Render x y a -> OmRender ctx x y a

Lift a standard React hook into OmRender.

#bind Source

bind :: forall a b x y z ctx. OmRender ctx x y a -> (a -> OmRender ctx y z b) -> OmRender ctx x z b

#discard Source

discard :: forall a b x y z ctx. OmRender ctx x y a -> (a -> OmRender ctx y z b) -> OmRender ctx x z b

#pure Source

pure :: forall a x ctx. a -> OmRender ctx x x a

#useState Source

useState :: forall ctx state hooks. state -> OmRender ctx hooks (UseState state hooks) (state /\ ((state -> state) -> Effect Unit))

#useState' Source

useState' :: forall ctx state hooks. state -> OmRender ctx hooks (UseState state hooks) (state /\ (state -> Effect Unit))

#useEffect Source

useEffect :: forall ctx deps hooks. Eq deps => deps -> Effect (Effect Unit) -> OmRender ctx hooks (UseEffect deps hooks) Unit

#useEffectOnce Source

useEffectOnce :: forall ctx hooks. Effect (Effect Unit) -> OmRender ctx hooks (UseEffect Unit hooks) Unit

#useEffectAlways Source

useEffectAlways :: forall ctx hooks. Effect (Effect Unit) -> OmRender ctx hooks (UseEffect Unit hooks) Unit

#useLayoutEffect Source

useLayoutEffect :: forall ctx deps hooks. Eq deps => deps -> Effect (Effect Unit) -> OmRender ctx hooks (UseLayoutEffect deps hooks) Unit

#useLayoutEffectOnce Source

useLayoutEffectOnce :: forall ctx hooks. Effect (Effect Unit) -> OmRender ctx hooks (UseLayoutEffect Unit hooks) Unit

#useLayoutEffectAlways Source

useLayoutEffectAlways :: forall ctx hooks. Effect (Effect Unit) -> OmRender ctx hooks (UseLayoutEffect Unit hooks) Unit

#useRef Source

useRef :: forall ctx a hooks. a -> OmRender ctx hooks (UseRef a hooks) (Ref a)

#useMemo Source

useMemo :: forall ctx deps a hooks. Eq deps => deps -> (Unit -> a) -> OmRender ctx hooks (UseMemo deps a hooks) a

#useReducer Source

useReducer :: forall ctx state action hooks. state -> Reducer state action -> OmRender ctx hooks (UseReducer state action hooks) (state /\ (action -> Effect Unit))

#useId Source

useId :: forall ctx hooks. OmRender ctx hooks (UseId hooks) String

#useTransition Source

useTransition :: forall ctx hooks. OmRender ctx hooks (UseTransition hooks) (Boolean /\ ((Effect Unit) -> Effect Unit))

#useDeferredValue Source

useDeferredValue :: forall ctx a hooks. a -> OmRender ctx hooks (UseDeferredValue a hooks) a

Re-exports from React.Basic.Hooks

#UseTransition Source

#UseState Source

data UseState t0 t1

#UseRef Source

data UseRef t0 t1

#UseReducer Source

data UseReducer t0 t1 t2

#UseMemo Source

data UseMemo t0 t1 t2

#UseLayoutEffect Source

data UseLayoutEffect t0 t1

#UseId Source

data UseId t0

#UseEffect Source

data UseEffect t0 t1

#UseDeferredValue Source

data UseDeferredValue t0 t1

#Reducer Source

newtype Reducer state action