# How to make a React.js-based page within Discourse that only re-uses its header and session?

**URL:** <https://meta.discourse.org/t/how-to-make-a-react-js-based-page-within-discourse-that-only-re-uses-its-header-and-session/46927>\
**Category:** Development\
**Created:** [2016 年7 月 7 日 02:47 UTC](https://meta.discourse.org/t/how-to-make-a-react-js-based-page-within-discourse-that-only-re-uses-its-header-and-session/46927 "2016-07-07T02:47:30Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

作者： ![gdpelican](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gdpelican/32/81308_2.png) [@gdpelican](https://meta.discourse.org/u/gdpelican)\
发布日期： [2016 年7 月 7 日 06:12 UTC](https://meta.discourse.org/t/how-to-make-a-react-js-based-page-within-discourse-that-only-re-uses-its-header-and-session/46927/7 "2016-07-07T06:12:31Z")

</div>

What you’re proposing would have to go through some circus like

- Call to domain/my-page.html
- Discourse 404’s
- Your custom JS catches that 404, recognizes that it came from your custom route somehow, and.. renders the whole template into the 404 div?
- Meanwhile, it also loads a react component, which.. I guess gets slid into a particular DOM element using react-dom-inject or something?
- Then it subscribes to messageBus, err maybe by loading something like `let messageBus = Discourse. __container__.lookup('messageBus:main').subscribe`? (\<-- this code I think still works today, but likely won’t forever, or even for much longer)

I don’t quite get it; why is creating a custom plugin, or using Ember, not an option here?

I get that the plugin architecture and perhaps Ember has a steep learning curve, but this is really using a 🔨 to churn the butter.

---

_[View the full topic](https://meta.discourse.org/t/how-to-make-a-react-js-based-page-within-discourse-that-only-re-uses-its-header-and-session/46927)._
