final class Step4[P, C <: Children, S, B, US <: UpdateSnapshot] extends AnyRef
You're on the final step on the way to building a component.
This is where you add lifecycle callbacks if you need to.
When you're done, simply call .build to create and return your ScalaComponent.
- Alphabetic
- By Inheritance
- Step4
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Step4(name: String, initState: InitState[P, S], backendFn: NewBackendFn[P, S, B], renderFn: RenderFn[P, S, B], lifecycle: Lifecycle[P, S, B, US.Value])
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
build(implicit ctorType: Summoner[Box[P], C], snapshotJs: JsRepr[SnapshotValue]): Component[P, S, B, CT]
This is the end of the road for this component builder.
This is the end of the road for this component builder.
- returns
Your brand-new, spanking, ScalaComponent. Mmmmmmmm, new-car smell.
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
def
componentDidCatch(f: ComponentDidCatchFn[P, S, B]): This
Error boundaries are React components that catch errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed.
Error boundaries are React components that catch errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed. Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.
Note: "CHILD COMPONENT TREE". Components cannot catch errors in themselves, only their children.
- def componentDidCatchConst(cb: Callback): This
-
def
componentDidMount(f: ComponentDidMountFn[P, S, B]): This
Invoked once, only on the client (not on the server), immediately after the initial rendering occurs.
Invoked once, only on the client (not on the server), immediately after the initial rendering occurs. At this point in the lifecycle, the component has a DOM representation which you can access via
ReactDOM.findDOMNode(this). ThecomponentDidMount()method of child components is invoked before that of parent components.If you want to integrate with other JavaScript frameworks, set timers using
setTimeoutorsetInterval, or send AJAX requests, perform those operations in this method. - def componentDidMountConst(cb: Callback): This
-
def
componentDidUpdate(f: ComponentDidUpdateFn[P, S, B, SnapshotValue]): Step4[P, C, S, B, Some[SnapshotValue]]
Invoked immediately after the component's updates are flushed to the DOM.
Invoked immediately after the component's updates are flushed to the DOM. This method is not called for the initial render.
Use this as an opportunity to operate on the DOM when the component has been updated.
- def componentDidUpdateConst(cb: Callback): Step4[P, C, S, B, Some[SnapshotValue]]
-
def
componentWillUnmount(f: ComponentWillUnmountFn[P, S, B]): This
Invoked immediately before a component is unmounted from the DOM.
Invoked immediately before a component is unmounted from the DOM.
Perform any necessary cleanup in this method, such as invalidating timers or cleaning up any DOM elements that were created in
componentDidMount. - def componentWillUnmountConst(cb: Callback): This
-
def
configure[US2 <: UpdateSnapshot](f: Config[P, C, S, B, US, US2]): Step4[P, C, S, B, US2]
- Annotations
- @inline()
-
def
configureUnless(cond: Boolean)(f: ⇒ Config[P, C, S, B, US, US]): Step4[P, C, S, B, US]
- Annotations
- @inline()
-
def
configureWhen(cond: Boolean)(f: ⇒ Config[P, C, S, B, US, US]): Step4[P, C, S, B, US]
- Annotations
- @inline()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
getDerivedStateFromProps(f: (P) ⇒ S): This
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.
-
def
getDerivedStateFromProps(f: (P, S) ⇒ S): This
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.
-
def
getDerivedStateFromPropsOption(f: (P) ⇒ Option[S]): This
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. It should return Some to update the state, or None to update nothing.
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
getDerivedStateFromPropsOption(f: (P, S) ⇒ Option[S]): This
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. It should return Some to update the state, or None to update nothing.
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
getSnapshotBeforeUpdate[A](f: GetSnapshotBeforeUpdateFn[P, S, B, A])(implicit ev: SafetyProof[US]): Step4[P, C, S, B, Some[A]]
getSnapshotBeforeUpdate() is invoked right before the most recently rendered output is committed to e.g.
getSnapshotBeforeUpdate() is invoked right before the most recently rendered output is committed to e.g. the DOM. It enables your component to capture some information from the DOM (e.g. scroll position) before it is potentially changed. Any value returned by this lifecycle will be passed as a parameter to componentDidUpdate().
This use case is not common, but it may occur in UIs like a chat thread that need to handle scroll position in a special way.
- Annotations
- @nowarn( "cat=unused" )
-
def
getSnapshotBeforeUpdatePure[A](f: (GetSnapshotBeforeUpdate[P, S, B]) ⇒ A)(implicit ev: SafetyProof[US]): Step4[P, C, S, B, Some[A]]
getSnapshotBeforeUpdate() is invoked right before the most recently rendered output is committed to e.g.
getSnapshotBeforeUpdate() is invoked right before the most recently rendered output is committed to e.g. the DOM. It enables your component to capture some information from the DOM (e.g. scroll position) before it is potentially changed. Any value returned by this lifecycle will be passed as a parameter to componentDidUpdate().
This use case is not common, but it may occur in UIs like a chat thread that need to handle scroll position in a special way.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val name: String
-
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
shouldComponentUpdate(f: ShouldComponentUpdateFn[P, S, B]): This
Invoked before rendering when new props or state are being received.
Invoked before rendering when new props or state are being received. This method is not called for the initial render or when
forceUpdateis used.Use this as an opportunity to
return falsewhen you're certain that the transition to the new props and state will not require a component update.If
shouldComponentUpdatereturns false, thenrender()will be completely skipped until the next state change. In addition,componentWillUpdateandcomponentDidUpdatewill not be called.By default,
shouldComponentUpdatealways returnstrueto prevent subtle bugs whenstateis mutated in place, but if you are careful to always treatstateas immutable and to read only frompropsandstateinrender()then you can overrideshouldComponentUpdatewith an implementation that compares the old props and state to their replacements.If performance is a bottleneck, especially with dozens or hundreds of components, use
shouldComponentUpdateto speed up your app. - def shouldComponentUpdateConst(b: Boolean): This
- def shouldComponentUpdateConst(cb: CallbackTo[Boolean]): This
-
def
shouldComponentUpdatePure(f: (ShouldComponentUpdate[P, S, B]) ⇒ Boolean): This
Invoked before rendering when new props or state are being received.
Invoked before rendering when new props or state are being received. This method is not called for the initial render or when
forceUpdateis used.Use this as an opportunity to
return falsewhen you're certain that the transition to the new props and state will not require a component update.If
shouldComponentUpdatereturns false, thenrender()will be completely skipped until the next state change. In addition,componentWillUpdateandcomponentDidUpdatewill not be called.By default,
shouldComponentUpdatealways returnstrueto prevent subtle bugs whenstateis mutated in place, but if you are careful to always treatstateas immutable and to read only frompropsandstateinrender()then you can overrideshouldComponentUpdatewith an implementation that compares the old props and state to their replacements.If performance is a bottleneck, especially with dozens or hundreds of components, use
shouldComponentUpdateto speed up your app. -
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( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
componentWillMount(f: ComponentWillMountFn[P, S, B]): This
Invoked once, both on the client and server, immediately before the initial rendering occurs.
Invoked once, both on the client and server, immediately before the initial rendering occurs. If you call
setStatewithin this method,render()will see the updated state and will be executed only once despite the state change.- Annotations
- @deprecated
- Deprecated
(Since version scalajs-react 1.7.0 / React 16.9.0) Use either .initialState* on the component builder, or .componentDidMount. See https://reactjs.org/docs/react-component.html#unsafe_componentwillmount / https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html
-
def
componentWillMountConst(cb: Callback): This
- Annotations
- @deprecated
- Deprecated
(Since version scalajs-react 1.7.0 / React 16.9.0) Use either .initialState* on the component builder, or .componentDidMount. See https://reactjs.org/docs/react-component.html#unsafe_componentwillmount / https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html
-
def
componentWillReceiveProps(f: ComponentWillReceivePropsFn[P, S, B]): This
Invoked when a component is receiving new props.
Invoked when a component is receiving new props. This method is not called for the initial render.
Use this as an opportunity to react to a prop transition before
render()is called by updating the state usingthis.setState(). The old props can be accessed viathis.props. Callingthis.setState()within this function will not trigger an additional render.Note: There is no analogous method
componentWillReceiveState. An incoming prop transition may cause a state change, but the opposite is not true. If you need to perform operations in response to a state change, usecomponentWillUpdate.- Annotations
- @deprecated
- Deprecated
(Since version scalajs-react 1.7.0 / React 16.9.0) See https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops / https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html
-
def
componentWillReceivePropsConst(cb: Callback): This
- Annotations
- @deprecated
- Deprecated
(Since version scalajs-react 1.7.0 / React 16.9.0) See https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops / https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html
-
def
componentWillUpdate(f: ComponentWillUpdateFn[P, S, B]): This
Invoked immediately before rendering when new props or state are being received.
Invoked immediately before rendering when new props or state are being received. This method is not called for the initial render.
Use this as an opportunity to perform preparation before an update occurs.
Note: You *cannot* use
this.setState()in this method. If you need to update state in response to a prop change, usecomponentWillReceivePropsinstead.- Annotations
- @deprecated
- Deprecated
(Since version scalajs-react 1.7.0 / React 16.9.0) Use .componentDidUpdate or .getSnapshotBeforeUpdate. See https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate / https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html
-
def
componentWillUpdateConst(cb: Callback): This
- Annotations
- @deprecated
- Deprecated
(Since version scalajs-react 1.7.0 / React 16.9.0) Use .componentDidUpdate or .getSnapshotBeforeUpdate. See https://reactjs.org/docs/react-component.html#unsafe_componentwillupdate / https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.