Skip to content

v0.8.0

Compare
Choose a tag to compare
@shogowada shogowada released this 15 Apr 23:10
· 32 commits to master since this release

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
    <(new MyClassSpec())(/* props */)(/* children */)
    instead of
    (new MyClassSpec())(/* props */)(/* children */)
  • Use ^.wrapped to assign custom props and props.wrapped to access them
    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
    )
    This means you can now assign standard props with ease.
    ReactDOM.render(
      <(new MyComponent())(
        ^.id := "my-component",
        ^.wrapped := MyComponent.WrappedProps(message = "Hi")
      )(),
      mountNode
    )
    And access standard props with no workaround (e.g. children method).
    class MyComponent extends StaticReactClassSpec {
      override def render(): ReactElement = <.div()(props.children)
    }
  • Use props.children to access children instead of children
  • Use RouterProps trait instead of RoutedReactClassSpec[Params] to access router props
    • Use props.history, props.location, and props.match to access router props
  • Use <.Provider(^.store := store)(<(App()).empty) instead of <.Provider(store = store)(App())