> ## Content Index
> Fetch the complete content index at: https://www.mrstebo.co.uk/llms.txt
> Use this file to discover other available public pages before exploring further.

# Component-based Classic ASP — React in Classic ASP??? 😮
- URL: https://www.mrstebo.co.uk/component-based-classic-asp-react-in-classic-asp/
- Published: 2017-03-26T23:00:00.000Z
- Updated: 2023-05-15T23:43:52.000Z
- Author: Steven Atkinson
- Tags: Software Development, Software Engineering, Software Architecture, React, Classic ASP

Lately I have been working a lot with React and Redux, and have found the concept of creating reusable components to be very useful. I have also been **blessed* with working on some Classic ASP, which has got me thinking…

****Could we create reusable components using Classic ASP?**

I’ve had a bit of a play with a simple project structure that enables you to create some basic components. It is not as pretty as React (as you would expect), but it seems to get the job done!

![](https://miro.medium.com/v2/resize:fit:485/0*SYcKMyKe__6xcYFK.png)

# How do we write a component?

The example components that I have created are very simple. They have only one publicly exposed function called `Render`. All this method does is return compiled HTML.  
My first thought was to perhaps just build the HTML inside the `Render` function, but I wanted to enable all the nice snippets that I can use in ****Atom**. So I separated out the HTML inside its very own file. This is then read by the `Render` method.

# Alright, lets see the code!

## The Header Component

## The BodyContainer Component

The ****includes.asp** file just includes all the components.

# How do I add components to my page?

In the example project the components are used in the ****index.asp** page. I have included Bootstrap just to make things look pretty.

Basically, all we are doing is a `Response.Write` and passing the returned HTML from the components `Render` function.

# What next?

As I said in the beginning, this is just a very basic example of creating reusable components for Classic ASP. You could:

- Create components that could take in some parameters to affect how the component is rendered.
- Create a routing component that decides what child components it needs to render (trying to simulate a SPA???)

**I’m not saying that this is a good idea…it was just something I was thinking about* 😄