trait ReactionRouterDOMComponent extends RoutingSourceComponent[PathParts, String] with RoutingConfig[PathParts, String]
Routing using this facade's router context provider and targeted for the DOM
and browser URLs. You don't need this class, you could just listen to the
history changes using a browser's history API or the "history" js
package. Use a instance of this component as an ancestor to provide the
latest "history" location in a react context then use the Route
component,
a value dependent type, to perform routing anywhere in the application. The
F context is Id so there is no effect wrapping a rule's Action.
You may also want to look at the code behind the [history github](https://github.com/ReactTraining/history) package or [react-router-navigation-prompt](https://github.com/ZacharyRSmith/react-router-navigation-prompt) in order to see how to take an user confirmed action such as saving changes before routing away. If you roll your own, you will need to register an "beforeonload" handler with the window when the user types in a new URL and throw up a dialog. You can also register with the document's history object to indepdently listen to history changes and if the URLs are different, throw up a dialog.
- Alphabetic
- By Inheritance
- ReactionRouterDOMComponent
- RoutingConfig
- RoutingSourceComponent
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract type Config <: ConfigLike
- Definition Classes
- ReactionRouterDOMComponent → RoutingConfig
- trait ConfigLike extends ReactionRouterDOMComponent.ConfigLike
- type Control = DOMControl
- Definition Classes
- ReactionRouterDOMComponent → RoutingConfig
- case class DOMControl(config: Config) extends ControlLike with Product with Serializable
- type Navigator = (String, Redirect) => Unit
- Definition Classes
- RoutingConfig
- type RouterInfo = RouterInfoLike
- Definition Classes
- ReactionRouterDOMComponent → RoutingSourceComponent
- case class RouterInfoLike(info: Option[PathParts] = None) extends ReactionRouterDOMComponent.RouterInfoLike with Product with Serializable
Context type.
- type Rules = (PathParts) => Action
If your rule needs a Control for rendering a
ReactNode
, theRender
action takes aControl => ReactNode
so essentially you have, for rendering, aInfo => Control => ReactNode
.If your rule needs a Control for rendering a
ReactNode
, theRender
action takes aControl => ReactNode
so essentially you have, for rendering, aInfo => Control => ReactNode
. Note that action does not return an effectful action e.g. Action is not wrapped in a F context.- Definition Classes
- RoutingConfig
- type State = Option[PathParts]
- Definition Classes
- RoutingSourceComponent
- sealed trait Action extends Product with Serializable
Take some action as the result of processing a rule.
Take some action as the result of processing a rule.
- Definition Classes
- RoutingConfig
- trait ControlLike extends AnyRef
Callback arg used by components that hides router and navigation implementation details.
Callback arg used by components that hides router and navigation implementation details. Not async! When your action is render, you receive a Control as a parameter that you pass to your child component so they can perform navigation actions, such as render a link element. You can curry the navigate function so that components can be fed a simpler To => Unit callback.
- Definition Classes
- RoutingConfig
- case class RedirectTo(to: To, method: Redirect, effect: () => Unit = noop) extends Action with Product with Serializable
Go to another page with a specific method to get there.
Go to another page with a specific method to get there.
- Definition Classes
- RoutingConfig
- case class Render(run: (Control) => ReactNode, effect: () => Unit = noop) extends Action with Product with Serializable
Render a node allowing that node to use Controls to create "links".
Render a node allowing that node to use Controls to create "links". Can render to null!
- Definition Classes
- RoutingConfig
- case class rule(run: (Info) => Option[Action]) extends Product with Serializable
Small rules DSL.
Small rules DSL. Create a rule that can return an optional action.
- Definition Classes
- RoutingConfig
- sealed trait NavAction extends AnyRef
- Attributes
- protected
- Definition Classes
- RoutingSourceComponent
- case class NewInfo(info: Info) extends NavAction with Product with Serializable
- Attributes
- protected
- Definition Classes
- RoutingSourceComponent
- trait Props extends Object
- Definition Classes
- RoutingSourceComponent
- Annotations
- @JSType()
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
- val Name: String
Override to change the name.
Override to change the name.
- Definition Classes
- ReactionRouterDOMComponent → RoutingSourceComponent
- val RouterContext: ReactContext[RouterInfo]
- Definition Classes
- RoutingSourceComponent
- def always(always: => Action): Rules
Create a rule that ignores the Info inpt.
Create a rule that ignores the Info inpt. Provides semantic gesture.
- Definition Classes
- RoutingConfig
- def apply(children_: ReactNode): ReactNode
- Definition Classes
- RoutingSourceComponent
- 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 hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def makeContextValue(info: Option[PathParts]): RouterInfoLike
- Definition Classes
- ReactionRouterDOMComponent → RoutingSourceComponent
- def makeControl(config: Config): DOMControl
- Attributes
- protected
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val noop: () => Unit
- Definition Classes
- RoutingConfig
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def performRoutingAction(routing: RoutingSource[PathParts, String], config: Config, to: String, method: Redirect): Unit
Override to extend.
Override to extend.
- Attributes
- protected
- Definition Classes
- ReactionRouterDOMComponent → RoutingConfig
- def render: (Props) => ReactNode
- Definition Classes
- RoutingSourceComponent
- val routing: RoutingSource[PathParts, String]
- Attributes
- protected
- Definition Classes
- ReactionRouterDOMComponent → RoutingSourceComponent
- def rules(run: (PathParts) => Action): Rules
Create rules, you don't need to use this.
Create rules, you don't need to use this. Provides semantic gesture.
- Definition Classes
- RoutingConfig
- def shouldRoute(p: PathParts, to: String): Boolean
- Attributes
- protected
- 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])
- object Route
A component that uses the context provider and a Config to route.
A component that uses the context provider and a Config to route.
- To do
Schedule effect to be run after rule action using a reducerComponent.
- object ShowIfMatch
If the predicate is true, show the child component and optionally alter the context the child sees to reflect the match e.g.
If the predicate is true, show the child component and optionally alter the context the child sees to reflect the match e.g. strip off the front segment of the URL.
- Definition Classes
- RoutingSourceComponent
- case object Subscribe extends NavAction with Product with Serializable
- Attributes
- protected
- Definition Classes
- RoutingSourceComponent