Module

Reactix

Package
purescript-reactix
Repository
garganscript/purescript-reactix

Re-exports from Reactix.Hooks

#State Source

type State state = Tuple state ((state -> state) -> Effect Unit)

A state hook is a tuple of value and setter

#Setter Source

type Setter t = (t -> t) -> Effect Unit

#Reducer Source

type Reducer state action = Tuple state (action -> Effect Unit)

A reducer hook is a tuple of value and reducer-setter

#useState' Source

useState' :: forall s. s -> Hooks (State s)

#useState Source

useState :: forall s. (Unit -> s) -> Hooks (State s)

Given an Effect function returning an initial value, returns a State

#useRef Source

useRef :: forall r. r -> Hooks (Ref r)

#useReducer' Source

useReducer' :: forall s a. (s -> a -> s) -> s -> Hooks (Reducer s a)

Like useReducer, but takes an initial state instead of an initialiser function and argument

#useReducer Source

useReducer :: forall s a i. (s -> a -> s) -> (i -> s) -> i -> Hooks (Reducer s a)

Given a reducer function from a state and action to a new state, an initialiser function and argument for the initialiser, returns a Reducer. Note args 2 and 3 are swapped in order from React.

#useMemo5 Source

useMemo5 :: forall a b c d e t. a -> b -> c -> d -> e -> (Unit -> t) -> Hooks t

Like useMemo but takes 5 memo values

#useMemo4 Source

useMemo4 :: forall a b c d t. a -> b -> c -> d -> (Unit -> t) -> Hooks t

Like useMemo but takes 4 memo values

#useMemo3 Source

useMemo3 :: forall a b c t. a -> b -> c -> (Unit -> t) -> Hooks t

Like useMemo but takes 3 memo values

#useMemo2 Source

useMemo2 :: forall a b t. a -> b -> (Unit -> t) -> Hooks t

Like useMemo but takes 2 memo values

#useMemo1 Source

useMemo1 :: forall a t. a -> (Unit -> t) -> Hooks t

Like useMemo but takes a memo value

#useMemo Source

useMemo :: forall t. (Unit -> t) -> Hooks t

Given a function to compute an expensive value, returns the value

#useLayoutEffectFn5' Source

useLayoutEffectFn5' :: forall a b c d e. a -> b -> c -> d -> e -> (a -> b -> c -> d -> e -> Effect Unit) -> Hooks Unit

like useLayoutEffectFn1', but with five memo values

#useLayoutEffectFn5 Source

useLayoutEffectFn5 :: forall a b c d e. a -> b -> c -> d -> e -> (a -> b -> c -> d -> e -> Effect (Effect Unit)) -> Hooks Unit

like useLayoutEffectFn1, but with five memo values

#useLayoutEffectFn4' Source

useLayoutEffectFn4' :: forall a b c d. a -> b -> c -> d -> (a -> b -> c -> d -> Effect Unit) -> Hooks Unit

like useLayoutEffectFn1', but with four memo values

#useLayoutEffectFn4 Source

useLayoutEffectFn4 :: forall a b c d. a -> b -> c -> d -> (a -> b -> c -> d -> Effect (Effect Unit)) -> Hooks Unit

like useLayoutEffectFn1, but with four memo values

#useLayoutEffectFn3' Source

useLayoutEffectFn3' :: forall a b c. a -> b -> c -> (a -> b -> c -> Effect Unit) -> Hooks Unit

like useLayoutEffectFn1', but with three memo values

#useLayoutEffectFn3 Source

useLayoutEffectFn3 :: forall a b c. a -> b -> c -> (a -> b -> c -> Effect (Effect Unit)) -> Hooks Unit

like useLayoutEffectFn1, but with three memo values

#useLayoutEffectFn2' Source

useLayoutEffectFn2' :: forall a b. a -> b -> (a -> b -> Effect Unit) -> Hooks Unit

like useLayoutEffectFn1', but with two memo values

#useLayoutEffectFn2 Source

useLayoutEffectFn2 :: forall a b. a -> b -> (a -> b -> Effect (Effect Unit)) -> Hooks Unit

like useLayoutEffectFn1, but with two memo values

#useLayoutEffectFn1' Source

useLayoutEffectFn1' :: forall a. a -> (a -> Effect Unit) -> Hooks Unit

Like useLayoutEffect1, but takes a function from memo value to effect

#useLayoutEffectFn1 Source

useLayoutEffectFn1 :: forall a. a -> (a -> Effect (Effect Unit)) -> Hooks Unit

Like useLayoutEffect1, but takes a function from memo value to effect

#useLayoutEffect5' Source

useLayoutEffect5' :: forall a b c d e f. a -> b -> c -> d -> e -> Effect f -> Hooks Unit

Like useLayoutEffect1' but with 5 memo values

#useLayoutEffect5 Source

useLayoutEffect5 :: forall a b c d e. a -> b -> c -> d -> e -> Effect (Effect Unit) -> Hooks Unit

Like useLayoutEffect, but with 5 memo values

#useLayoutEffect4' Source

useLayoutEffect4' :: forall a b c d e. a -> b -> c -> d -> Effect e -> Hooks Unit

Like useLayoutEffect1' but with 4 memo values

#useLayoutEffect4 Source

useLayoutEffect4 :: forall a b c d. a -> b -> c -> d -> Effect (Effect Unit) -> Hooks Unit

Like useLayoutEffect, but with 4 memo values

#useLayoutEffect3' Source

useLayoutEffect3' :: forall a b c d. a -> b -> c -> Effect d -> Hooks Unit

Like useLayoutEffect1' but with 3 memo values

#useLayoutEffect3 Source

useLayoutEffect3 :: forall a b c. a -> b -> c -> Effect (Effect Unit) -> Hooks Unit

Like useLayoutEffect, but with 3 memo values

#useLayoutEffect2' Source

useLayoutEffect2' :: forall a b c. a -> b -> Effect c -> Hooks Unit

Like useLayoutEffect1' but with 2 memo values

#useLayoutEffect2 Source

useLayoutEffect2 :: forall a b. a -> b -> Effect (Effect Unit) -> Hooks Unit

Like useLayoutEffect, but with 2 memo values

#useLayoutEffect1' Source

useLayoutEffect1' :: forall a b. a -> Effect b -> Hooks Unit

Like useLayoutEffect1, but the provided Effect fn does not return a cleanup handler

#useLayoutEffect1 Source

useLayoutEffect1 :: forall a. a -> Effect (Effect Unit) -> Hooks Unit

Like useLayoutEffect, but with a memo value

#useLayoutEffect' Source

useLayoutEffect' :: forall a. Effect a -> Hooks Unit

Like useLayoutEffect, but the provided Effect fn does not return a cleanup handler

#useLayoutEffect Source

useLayoutEffect :: Effect (Effect Unit) -> Hooks Unit

Given an Effect function which returns a cleanup Effect function, register an effect to be called in the same phase as componentDidMount and componentDidUpdate used to be.

#useImperativeHandle5 Source

useImperativeHandle5 :: forall a b c d e r r'. a -> b -> c -> d -> e -> Ref r -> Effect r' -> Hooks Unit

#useImperativeHandle4 Source

useImperativeHandle4 :: forall a b c d r r'. a -> b -> c -> d -> Ref r -> Effect r' -> Hooks Unit

#useImperativeHandle3 Source

useImperativeHandle3 :: forall a b c r r'. a -> b -> c -> Ref r -> Effect r' -> Hooks Unit

#useImperativeHandle2 Source

useImperativeHandle2 :: forall a b r r'. a -> b -> Ref r -> Effect r' -> Hooks Unit

#useImperativeHandle1 Source

useImperativeHandle1 :: forall a r r'. a -> Ref r -> Effect r' -> Hooks Unit

#useImperativeHandle Source

useImperativeHandle :: forall r r'. Ref r -> Effect r' -> Hooks Unit

#useEffectOnce' Source

useEffectOnce' :: forall a. Effect a -> Hooks Unit

Like useEffectOnce, but the provided Effect fn does not return a cleanup handler

#useEffectOnce Source

useEffectOnce :: Effect (Effect Unit) -> Hooks Unit

Like useEffect, but runs only once in the lifecycle of the component The initial effect will be fired at mount and the cleanup effect will be fired at unmount

#useEffectFn5' Source

useEffectFn5' :: forall a b c d e. a -> b -> c -> d -> e -> (a -> b -> c -> d -> e -> Effect Unit) -> Hooks Unit

like useEffectFn1', but with five memo values

#useEffectFn5 Source

useEffectFn5 :: forall a b c d e. a -> b -> c -> d -> e -> (a -> b -> c -> d -> e -> Effect (Effect Unit)) -> Hooks Unit

like useEffectFn1, but with five memo values

#useEffectFn4' Source

useEffectFn4' :: forall a b c d. a -> b -> c -> d -> (a -> b -> c -> d -> Effect Unit) -> Hooks Unit

like useEffectFn1', but with four memo values

#useEffectFn4 Source

useEffectFn4 :: forall a b c d. a -> b -> c -> d -> (a -> b -> c -> d -> Effect (Effect Unit)) -> Hooks Unit

like useEffectFn1, but with four memo values

#useEffectFn3' Source

useEffectFn3' :: forall a b c. a -> b -> c -> (a -> b -> c -> Effect Unit) -> Hooks Unit

like useEffectFn1', but with three memo values

#useEffectFn3 Source

useEffectFn3 :: forall a b c. a -> b -> c -> (a -> b -> c -> Effect (Effect Unit)) -> Hooks Unit

like useEffectFn1, but with three memo values

#useEffectFn2' Source

useEffectFn2' :: forall a b. a -> b -> (a -> b -> Effect Unit) -> Hooks Unit

like useEffectFn1', but with two memo values

#useEffectFn2 Source

useEffectFn2 :: forall a b. a -> b -> (a -> b -> Effect (Effect Unit)) -> Hooks Unit

like useEffectFn1, but with two memo values

#useEffectFn1' Source

useEffectFn1' :: forall a. a -> (a -> Effect Unit) -> Hooks Unit

Like useEffect1', but takes a function from memo value to effect

#useEffectFn1 Source

useEffectFn1 :: forall a. a -> (a -> Effect (Effect Unit)) -> Hooks Unit

Like useEffect1, but takes a function from memo value to effect

#useEffect5' Source

useEffect5' :: forall a b c d e f. a -> b -> c -> d -> e -> Effect f -> Hooks Unit

Like useEffect5, but the provided Effect fn does not return a cleanup handler

#useEffect5 Source

useEffect5 :: forall a b c d e. a -> b -> c -> d -> e -> Effect (Effect Unit) -> Hooks Unit

Like useEffect, but with 5 memo values

#useEffect4' Source

useEffect4' :: forall a b c d e. a -> b -> c -> d -> Effect e -> Hooks Unit

Like useEffect4, but the provided Effect fn does not return a cleanup handler

#useEffect4 Source

useEffect4 :: forall a b c d. a -> b -> c -> d -> Effect (Effect Unit) -> Hooks Unit

Like useEffect, but with 4 memo values

#useEffect3' Source

useEffect3' :: forall a b c d. a -> b -> c -> Effect d -> Hooks Unit

Like useEffect3, but the provided Effect fn does not return a cleanup handler

#useEffect3 Source

useEffect3 :: forall a b c. a -> b -> c -> Effect (Effect Unit) -> Hooks Unit

Like useEffect, but with 3 memo values

#useEffect2' Source

useEffect2' :: forall a b c. a -> b -> Effect c -> Hooks Unit

Like useEffect2, but the provided Effect fn does not return a cleanup handler

#useEffect2 Source

useEffect2 :: forall a b. a -> b -> Effect (Effect Unit) -> Hooks Unit

Like useEffect, but with 2 memo values

#useEffect1' Source

useEffect1' :: forall a b. a -> Effect b -> Hooks Unit

Like useEffect1, but the provided Effect fn does not return a cleanup handler

#useEffect1 Source

useEffect1 :: forall a. a -> Effect (Effect Unit) -> Hooks Unit

Like useEffect, but with a memo value

#useEffect' Source

useEffect' :: forall a. Effect a -> Hooks Unit

Like useEffect, but the provided Effect fn does not return a cleanup handler

#useEffect Source

useEffect :: Effect (Effect Unit) -> Hooks Unit

Given an Effect function which returns a cleanup Effect function, register an effect to be called after rendering

#useDebugValue' Source

useDebugValue' :: forall v. v -> Hooks Unit

#useDebugValue Source

useDebugValue :: forall v v'. v -> (v -> v') -> Hooks Unit

#useContext Source

useContext :: forall a. Context a -> Hooks a

Given a Context, returns its current value

#useCallback5 Source

useCallback5 :: forall a b c d e t. a -> b -> c -> d -> e -> (Unit -> t) -> Hooks (Effect t)

Like useCallback but takes 5 memo values

#useCallback4 Source

useCallback4 :: forall a b c d t. a -> b -> c -> d -> (Unit -> t) -> Hooks (Effect t)

Like useCallback but takes 4 memo values

#useCallback3 Source

useCallback3 :: forall a b c t. a -> b -> c -> (Unit -> t) -> Hooks (Effect t)

Like useCallback but takes 3 memo values

#useCallback2 Source

useCallback2 :: forall a b t. a -> b -> (Unit -> t) -> Hooks (Effect t)

Like useCallback but takes 2 memo values

#useCallback1 Source

useCallback1 :: forall a t. a -> (Unit -> t) -> Hooks (Effect t)

Like useCallback but takes a memo value

#useCallback Source

useCallback :: forall t. (Unit -> t) -> Hooks (Effect t)

Given a function to compute an expensive value, returns the value

#unsafeUseMemo Source

unsafeUseMemo :: forall t a. (Unit -> t) -> a -> Hooks t

Call React.useMemo passing an array-like object (arguments is acceptable) for memo values without any help from the type system to guarantee the memo value is in fact array-like.

#unsafeUseLayoutEffect Source

unsafeUseLayoutEffect :: forall a. Effect (Effect Unit) -> a -> Hooks Unit

Call React.useLayoutEffect passing an array-like object (arguments is acceptable) for memo values without any help from the type system to guarantee the memo value is in fact array-like.

#unsafeUseImperativeHandle Source

unsafeUseImperativeHandle :: forall r r' a. Ref r -> Effect r' -> a -> Hooks Unit

Call React.useImperativeHandle passing an array-like object (arguments is acceptable) for memo values without any help from the type system to guarantee the memo value is in fact array-like.

#unsafeUseEffect Source

unsafeUseEffect :: forall a. Effect (Effect Unit) -> a -> Hooks Unit

Call React.useEffect passing an array-like object (arguments is acceptable) for memo values without any help from the type system to guarantee the memo value is in fact array-like.

#unsafeUseCallback Source

unsafeUseCallback :: forall t a. (Unit -> t) -> a -> Hooks (Effect t)

Call React.useCallback passing an array-like object (arguments is acceptable) for memo values without any help from the type system to guarantee the memo value is in fact array-like.

#thenNothing Source

thenNothing :: forall a. Effect a -> Effect (Effect Unit)

Turns a simple effect function into an effect function that does nothing in cleanup after running

#nothing Source

nothing :: Effect Unit

A cleanup handler that does nothing

Re-exports from Reactix.React

#StaticComponent Source

#Ref Source

data Ref t0

#ReactDOM Source

#React Source

data React

#Provider Source

data Provider t0

The Provider for a React Context

Instances

#Memo Source

data Memo :: Row Type -> Typedata Memo t0

Instances

#HooksComponent Source

type HooksComponent :: Row Type -> Typetype HooksComponent props = Record props -> Array Element -> Hooks Element

The type of a function that can be turned into a component with hooksComponent. Will have access to the Hooks Monad.

#Element Source

data Element

A React Element node

Instances

#Context Source

data Context t0

A React Context

#Consumer Source

data Consumer t0

The Consumer for a React Context

Instances

#Component Source

newtype Component :: Row Type -> Typenewtype Component props

Instances

#IsComponent Source

class IsComponent :: Type -> Row Type -> Type -> Constraintclass IsComponent component (props :: Row Type) children | component -> props, component -> children where

Members

Instances

#MonadDelay Source

class MonadDelay :: (Type -> Type) -> Constraintclass (Monad m) <= MonadDelay m 

This class is for Monads whose side effect includes delayed computation. So far, it's Effect and Hooks.

Instances

#unsafeHooksEffect Source

unsafeHooksEffect :: forall a. Effect a -> Hooks a

#staticComponentWithModule Source

staticComponentWithModule :: forall props. Module -> String -> StaticComponent props -> Component props

#staticComponent Source

staticComponent :: forall props. String -> StaticComponent props -> Component props

Turns a StaticComponent function into a Component

#setRef Source

setRef :: forall r. Ref r -> r -> Effect Unit

#runHooks Source

runHooks :: forall a. Hooks a -> Effect a

#render Source

render :: Element -> Element -> Effect Unit

Renders a React Element to a real Element

#readRefM Source

readRefM :: forall r m. MonadDelay m => Ref r -> m r

#readRef Source

readRef :: forall r. Ref r -> r

#readNullableRefM Source

readNullableRefM :: forall r m. MonadDelay m => Ref (Nullable r) -> Effect (Maybe r)

#readNullableRef Source

readNullableRef :: forall r. Ref (Nullable r) -> Maybe r

#rawCreateElement Source

rawCreateElement :: forall c p cs. c -> p -> Array cs -> Element

#provider Source

provider :: forall v. Context v -> Provider v

#provideContext Source

provideContext :: forall v. Context v -> v -> Array Element -> Element

#provide Source

provide :: forall v. Provider v -> v -> Array Element -> Element

#memo' Source

memo' :: forall props. Component props -> Memo props

#memo Source

memo :: forall props. Component props -> (Record props -> Record props -> Boolean) -> Memo props

#isValid Source

isValid :: forall a. a -> Boolean

#hooksComponentWithModule Source

hooksComponentWithModule :: forall props. Module -> String -> HooksComponent props -> Component props

#hooksComponent Source

hooksComponent :: forall props. String -> HooksComponent props -> Component props

Turns a HooksComponent function into a Component

#fragment Source

fragment :: Array Element -> Element

Clones an element. Quite unsafe because tripping through Element loses the type of the props. Be careful. Combines several elements together

#createRef Source

createRef :: forall r. Unit -> NullableRef r

#createDOMElement Source

#createContext Source

createContext :: forall v. v -> Context v

Creates a Context from a given value

#consumer Source

consumer :: forall v. Context v -> Consumer v

#consumeContext Source

consumeContext :: forall v. Context v -> (v -> Element) -> Element

#consume Source

consume :: forall v. Consumer v -> (v -> Element) -> Element

Re-exports from Reactix.SyntheticEvent

#SyntheticEvent Source

#unsafeEventValue Source

unsafeEventValue :: forall event. event -> String

#unsafeEventTarget Source

unsafeEventTarget :: forall event. event -> Element