Component

korolev.Component
See theComponent companion object
abstract class Component[F[_], S, P, E](val initialState: Either[P => F[S], S], val id: String)

Component definition. Every Korolev application is a component. Extent it to declare component in object oriented style.

Attributes

E

Type of events produced by component

F

Control monad

S

State of the component

id

Unique identifier of the component. Use it when you create component declaration dynamically

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Constructors

def this(initialState: S)
def this(initialState: S, id: String)
def this(loadState: P => F[S])

Abstract methods

def render(parameters: P, state: S): Node

Component render

Component render

Attributes

Concrete methods

def maybeUpdateState(parameters: P, currentState: S): Option[F[S]]

Parameters may be changed. Maybe you want to reload state. The function returns optional effect. If no reload required it returns None, else it returns effect with new state.

Parameters may be changed. Maybe you want to reload state. The function returns optional effect. If no reload required it returns None, else it returns effect with new state.

Attributes

def renderNoState(parameters: P): Node

Render component while state is not loaded.

Render component while state is not loaded.

Attributes

Concrete fields

val context: Context[F, S, E]

Component context.

Component context.

import context._

Attributes

val id: String
val initialState: Either[P => F[S], S]