Search code examples
reactjsreact-routeroffice-jsyo

officejs react - how do I add another page?


I have created a Microsoft Office Add-in React (TypeScript) Project using yo office

How do I add another page? I want to create some additional UI which pops up in a dialog (ie. displayed using Office.context.ui.displayDialogAsync) so no need for loading officejs

I tried to use react-router but I didn't manage to get it working... The way index.tsx works is a bit different from the normal create-react-app template that most tutorials use.


Solution

  • I did this by adding:

    • a new tsx file for my page
    • a new HtmlWebpackPlugin in webpack.common.js with a new chunk name
    • an entry in webpack.common.js which links my tsx file with my chunk