final class Step1[P] extends AnyRef
You're on step 1/4 on the way to building a component.
If your component is to be stateful, here you must specify it's initial state.
If your component is to be stateless, you can skip this step or explicitly use .stateless.
- Alphabetic
- By Inheritance
- Step1
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Step1(name: String)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getDerivedStateFromPropsAndState[S](f: (P, Option[S]) => S): Step2[P, S]
This is called twice when a component is first rendered.
This is called twice when a component is first rendered. Once with state set to
Noneand then again by React with state set toSome.getDerivedStateFromProps is invoked right before calling the render method, both on the initial mount and on subsequent updates.
This method exists for rare use cases where the state depends on changes in props over time. For example, it might be handy for implementing a Transition component that compares its previous and next children to decide which of them to animate in and out.
Deriving state leads to verbose code and makes your components difficult to think about. Make sure you're familiar with simpler alternatives:
- If you need to perform a side effect (for example, data fetching or an animation) in response to a change in props, use componentDidUpdate lifecycle instead.
- If you want to re-compute some data only when a prop changes, use a memoization helper instead.
- If you want to "reset" some state when a prop changes, consider either making a component fully controlled or fully uncontrolled with a key instead.
Note that this method is fired on every render, regardless of the cause. This is in contrast to componentWillReceiveProps, which only fires when the parent causes a re-render and not as a result of a local setState.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def initialState[S](s: => S): Step2[P, S]
- def initialStateCallback[S](cb: CallbackTo[S]): Step2[P, S]
- def initialStateCallbackFromProps[S](f: (P) => CallbackTo[S]): Step2[P, S]
- def initialStateFromProps[S](f: (P) => S): Step2[P, S]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def stateless: Step2[P, Unit]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
- def getDerivedStateFromProps[S](f: (P) => S): Step2[P, S]
getDerivedStateFromProps is invoked right before calling the render method, both on the initial mount and on subsequent updates.
getDerivedStateFromProps is invoked right before calling the render method, both on the initial mount and on subsequent updates.
This method exists for rare use cases where the state depends on changes in props over time. For example, it might be handy for implementing a Transition component that compares its previous and next children to decide which of them to animate in and out.
Deriving state leads to verbose code and makes your components difficult to think about. Make sure you're familiar with simpler alternatives:
- If you need to perform a side effect (for example, data fetching or an animation) in response to a change in props, use componentDidUpdate lifecycle instead.
- If you want to re-compute some data only when a prop changes, use a memoization helper instead.
- If you want to "reset" some state when a prop changes, consider either making a component fully controlled or fully uncontrolled with a key instead.
Note that this method is fired on every render, regardless of the cause. This is in contrast to componentWillReceiveProps, which only fires when the parent causes a re-render and not as a result of a local setState.
- Annotations
- @deprecated
- Deprecated
(Since version 1.7.1) Use getDerivedStateFromPropsAndState instead. This doesn't just get called when props change, it gets called when state changes too; meaning it gets reset every time you call setState (!)