Dogstudio / highway

Highway - A Modern Javascript Transitions Manager
https://highway.js.org/
MIT License
1.43k stars 92 forks source link

Can we specify a renderer for dynamics URL #67

Closed Koubi4cK closed 4 years ago

Koubi4cK commented 4 years ago

Hello,

First of all thanks for your work, appreciate it !

I searched in the docs but can't find a way to specify a renderer for dynamic slugs like path/:id.

Thanks in advance,

Koubi4cK.

Anthodpnt commented 4 years ago

Hello @Koubi4cK

The renderer isn't related to a route, it's related to a view – or template. I'm guessing that all the pages using the path/:id route are also rendering the same view – or template. Therefore, in the view – or template – you have to define the data-router-wrapper and the data-router-view attributes and assign a value – or name – to the data-router-view attribute. This value – or name – will then be used in the Highway.Core declaration to attach the renderer to the view – or template – and thus to the dynamic route.

Check this out: Get Started - Highway

However, if you are using Highway with React, be aware that Highway doesn't support React. There are already a lot of libraries out there to manage page transitions in React pretty well.

Best regards, Anthodpnt

Anthodpnt commented 4 years ago

@Koubi4cK I'm closing this one since the last answer should be the solution to your problem. Feel free to reopen it if needed.