Trait/Object

io.github.shogowada.scalajs.reactjs.classes.specs

ReactClassSpec

Related Docs: object ReactClassSpec | package specs

Permalink

trait ReactClassSpec[Props, State] extends AnyRef

Specification for React components

Example:

object Foo {
  case class Props(foo: String)
  case class State(bar: String)
}

class Foo extends ReactClassSpec[Foo.Props, Foo.State] {
  import Foo._

  override def getInitialState() = State("bar")

  override def render(): ReactElement = <.div()(
    s"foo = ${props.foo}",
    s"bar = ${state.bar}",
    children // equivalent of props.children in native React
  )
}

val foo = new Foo()
ReactDOM.render(
  foo(Foo.Props("foo"))( // first parameter group of apply method takes props
    <.div()("first child"), // second parameter group of apply method takes children
    <.div()("second child")
  ),
  mountNode
)
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ReactClassSpec
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def getInitialState(): State

    Permalink
  2. abstract def render(): ReactElement

    Permalink

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def apply(props: Props)(children: Any*): ReactElement

    Permalink

    Returns ReactElement

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def asNative: Dynamic

    Permalink
  7. def children: ReactElement

    Permalink

    Returns props.children equivalent in native React

  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def componentDidMount(): Unit

    Permalink
  10. def componentDidUpdate(prevProps: Props, prevState: State): Unit

    Permalink
  11. def componentWillMount(): Unit

    Permalink
  12. def componentWillReceiveProps(nextProps: Props): Unit

    Permalink
  13. def componentWillUnmount(): Unit

    Permalink
  14. def componentWillUpdate(nextProps: Props, nextState: State): Unit

    Permalink
  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. def forceUpdate(): Unit

    Permalink
  19. def forceUpdate(callback: Function0[Unit]): Unit

    Permalink
  20. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  21. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  22. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  23. def nativeComponentDidUpdate(nativePrevProps: Dynamic, nativePrevState: Dynamic): Unit

    Permalink
  24. def nativeComponentWillReceiveProps(nativeNextProps: Dynamic): Unit

    Permalink
  25. def nativeComponentWillUpdate(nativeNextProps: Dynamic, nativeNextState: Dynamic): Unit

    Permalink
  26. def nativeProps: Dynamic

    Permalink
  27. def nativeShouldComponentUpdate(nextProps: Dynamic, nextState: Dynamic): Boolean

    Permalink
  28. def nativeState: Dynamic

    Permalink
  29. def nativeThis: Dynamic

    Permalink
  30. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  31. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  33. def props: Props

    Permalink
  34. def propsFromNative(nativeProps: Dynamic): Props

    Permalink
  35. def propsToNative(props: Props): Dynamic

    Permalink
  36. def setState(stateMapper: (State, Props) ⇒ State): Unit

    Permalink
  37. def setState(stateMapper: (State) ⇒ State): Unit

    Permalink
  38. def setState(state: State): Unit

    Permalink
  39. def shouldComponentUpdate(nextProps: Props, nextState: State): Boolean

    Permalink
  40. def state: State

    Permalink
  41. def stateFromNative(nativeState: Dynamic): State

    Permalink
  42. def stateToNative(state: State): Dynamic

    Permalink
  43. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  44. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  45. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped