Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to react-router v4 #27

Merged
merged 29 commits into from
Apr 15, 2017
Merged

Migrate to react-router v4 #27

merged 29 commits into from
Apr 15, 2017

Conversation

shogowada
Copy link
Owner

@shogowada shogowada commented Apr 15, 2017

TODOs:

  • Summarize breaking changes
  • Update documentation

Breaking Changes:

  • Drop support for Scala 2.11
    • It was having issue resolving WebBrowser class for no obvious reason.
  • 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())

Close #26

- Create react element via <(ReactClassSpec)(attribute: Any*)(contents: Any*) method
- Specify props via ^.wrapped attribute
- Use props.children to access children
- Use props.router, props.location, etc to access router props
It is replaced by props.children
It was having issue resolving class for WebBrowser for no obvious reason.
Travis is having issue finding 3.3.1
@shogowada shogowada merged commit fbe1403 into master Apr 15, 2017
@shogowada shogowada deleted the Correct_props branch April 15, 2017 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant