Packaging A React Component For Reuse In Other Visual Studio 2017 MVC Projects

- 1 answer

Building an MVC website in Visual Studio. The stack is as follows:

  • TypeScript React Components
  • Redux
  • C# backend

I'm looking to package/consolidate the company <Header />, it's child components (<Navbar /> etc..) and related CSS, images & font files.

The purpose of this is to consolidate company web elements, so that in future projects, components are generated by installing a Company.WebComponents NuGet or NPM package.

Then typing in <Header /> into any React page will populate all the items from the package. If the component or its children get modified at any point, they can be published and then updated on the rebuild and deployment of sites.

Does anyone have any suggestions for this kind of set up, or how you would approach this?



Just create a public or private npm package, we are doing that all the time at my work. You can follow this guide, it is a year old but is still accurate:

If you are using tfs/azure dev ops a private npm is included under the "Publish" tab.