v0.8.0
Enhancements:
- Migrated from react-router v3 to v4
Breaking changes:
- Drop support for Scala 2.11
- It was having issue resolving WebBrowser class for no obvious reason.
- react-router is renamed to react-router-dom
- Underlying library is split into react-router and react-router-dom. We want to use the -dom for web applications.
- When rendering components, use
instead of
<(new MyClassSpec())(/* props */)(/* children */)
(new MyClassSpec())(/* props */)(/* children */)
- Use
^.wrapped
to assign custom props andprops.wrapped
to access themThis means you can now assign standard props with ease.object MyComponent { case class WrappedProps(message: String) } class MyComponent extends StatelessReactClassSpec[MyComponent.WrappedProps] { override def render(): ReactElement = <.div()(props.wrapped.message) } ReactDOM.render( <(new MyComponent())(^.wrapped := MyComponent.WrappedProps(message = "Hi"))(), mountNode )
And access standard props with no workaround (e.g.ReactDOM.render( <(new MyComponent())( ^.id := "my-component", ^.wrapped := MyComponent.WrappedProps(message = "Hi") )(), mountNode )
children
method).class MyComponent extends StaticReactClassSpec { override def render(): ReactElement = <.div()(props.children) }
- Use
props.children
to access children instead ofchildren
- Use
RouterProps
trait instead ofRoutedReactClassSpec[Params]
to access router props- Use
props.history
,props.location
, andprops.match
to access router props
- Use
- Use
<.Provider(^.store := store)(<(App()).empty)
instead of<.Provider(store = store)(App())