Closed siddharth-vaghasia closed 2 years ago
Thanks for reaching out. You are correct that the default scaffolding will create a new page for each "interface" (tab, config etc). That is what is being scaffolded. But - there is nothing prohibiting you from changing this into more of a single page app and use a router. All you need to do is to update the manifest so that all pages/tabs points to the same page (for instance /myTab/index.html
) and then just append the has for each page (for instance /myTab/index.html
, /myTab/index.html#config
, /myTab/index.html#anotherTab
etc.)
This is also a good idea for a sample!
@wictorwilen - thanks for the reply and advice... I actually tried that but could not make it work but probably that is because of my limited knowledge of routers.... I am going to give it another try to make it work..... If I could make it work, would love to add it as a sample in teams app sample gallery...thanks anyways..!!!
Hi @siddharth-vaghasia ,
I've assigned this issue to you. Let us know if you need help with it. And thanks again for helping out ❤️
@RickVanRousselt - thanks...I am assuming we should add this to teams app sample gallery ?
@siddharth-vaghasia - yes, that would be the best location for it, and for you to showcase your skills!
@wictorwilen @RickVanRousselt - We have added the sample, Thanks @kunj-sangani for this help on making this work :)
Hello,
I am trying to figure out how to use routers with yo teams-based generated project...yo teams generated project structure has the first tab which gets rendered with URL /tabname
This is because of tabname/index.html inside the public folder basically indirectly using below line
teamsppReactRouter.render(teamsppReactRouter.TabName, document.getElementById('app'), {});
Now when we wanted to create a new page we have below option to
Create one more tab by running yo team again on the same project and it will create a new tab component and corresponding index.html insider public folder but this tab then acts as a single page application because of its own life cycle
I am trying to understand how to use React router concept inside the same project structure where I can create multiple pages inside the same project structure and use routers to redirect users to different routes and one of them being the main route(root).
Tried a few samples and code references but most of them work well and use routers/routes when the project is generated by using a stand-alone react app and not via yo teams...
As there are multiple ways to create a team's application... Just trying to figure out how yo teams being a native teams app generator library allow to use routers and support multiple pages with one application lifecycle and not each tab/page as a single page application.
Any help/advice is appreciated...