README.md in hyper-router-2.4.0 vs README.md in hyper-router-2.4.1

- old
+ new

@@ -1,8 +1,8 @@ -## HyperRouter +# ![](https://github.com/Serzhenka/hyper-loop-logos/blob/master/hyper-router_150.png)Hyper-router -HyperRouter allows you write and use the React Router in Ruby through Opal. +The Hyperloop Router allows you write and use the React Router in Ruby through Opal. ## Installation Add this line to your application's Gemfile: @@ -175,14 +175,14 @@ just like `redirect` without the first arg: `index_redirect(to: ... query: ...)` ### The Router Component -A router is defined as a subclass of `React::Router` which is itself a `React::Component::Base`. +A router is defined as a subclass of `Hyperloop::Router` which is itself a `Hyperloop::Component`. ```ruby -class Components::Router < React::Router +class Components::Router < Hyperloop::Router def routes # define your routes (there is no render method) route("/", mounts: About, index: Home) do route("about") route("inbox") do redirect('messages/:id').to { | params | "/messages/#{params[:id]}" } @@ -196,11 +196,11 @@ ``` #### Mounting your Router You will mount this component the usual way (i.e. via `render_component`, `Element#render`, `react_render`, etc) or even by mounting it within a higher level application component. ```ruby -class Components::App < React::Component::Base +class Components::App < Hyperloop::Component render(DIV) do Application::Nav() MAIN do Router() end @@ -243,11 +243,11 @@ There are several other methods that can be redefined to modify the routers behavior #### history ```ruby -class Router < React::Router +class Router < Hyperloop::Router def history ... return a history object end end ``` @@ -277,11 +277,11 @@ + Any falsy value: indicating that rendering should continue with no modification to behavior. + A `React::Element`, or a native `React.Element` which will be used for rendering. + Any truthy value: indicating that a new Element should be created using the (probably modified) params ```ruby -class Router < React::Router +class Router < Hyperloop::Router def create_element(component, component_params) # add the param :time_stamp to each element as its rendered React.create_element(component, component_params.merge(time_stamp: Time.now)) end end @@ -322,11 +322,11 @@ #### `stringify_query(params_hash)` <- needs work The method used to convert an object from <Link>s or calls to transitionTo to a URL query string. ```ruby -class Router < React::Router +class Router < Hyperloop::Router def stringify_query(params_hash) # who knows doc is a little unclear on this one...is it being passed the full params_hash or just # the query portion.... we shall see... end end @@ -358,12 +358,12 @@ This is primarily for integrating with other libraries that need to participate in rendering before the route components are rendered. It defaults to render={(props) => <RouterContext {...props} />}. Ensure that you render a <RouterContext> at the end of the line, passing all the props passed to render. -### React::Router::Component +### Hyperloop::Router::Component -The class React::Router::Component is a subclass of React::Component::Base that predefines the params that the router will be passing in to your component. This includes +The class Hyperloop::Router::Component is a subclass of Hyperloop::Component that predefines the params that the router will be passing in to your component. This includes `params.location` The current location.