{"id":19781982,"url":"https://github.com/sparkeduab/react-mounter","last_synced_at":"2026-06-12T00:31:11.935Z","repository":{"id":47876918,"uuid":"253216536","full_name":"SparkEdUAB/react-mounter","owner":"SparkEdUAB","description":"a fork of react-mounter from kadira-hq","archived":false,"fork":false,"pushed_at":"2023-01-27T07:53:18.000Z","size":696,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T02:30:04.701Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SparkEdUAB.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-05T11:15:02.000Z","updated_at":"2022-10-04T07:15:13.000Z","dependencies_parsed_at":"2023-02-15T06:45:59.343Z","dependency_job_id":null,"html_url":"https://github.com/SparkEdUAB/react-mounter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkEdUAB%2Freact-mounter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkEdUAB%2Freact-mounter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkEdUAB%2Freact-mounter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkEdUAB%2Freact-mounter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SparkEdUAB","download_url":"https://codeload.github.com/SparkEdUAB/react-mounter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241112293,"owners_count":19911663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T06:03:26.053Z","updated_at":"2026-06-12T00:31:11.885Z","avatar_url":"https://github.com/SparkEdUAB.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Mounter\n\nReact Mounter lets you mount React components to DOM easily.\n\nNote: This is a fork of [react-mounter](https://github.com/kadirahq/react-mounter) from kadira-hq\nit was no longer maintained and our project heavily depends on it, My plan is to keep this fork updated and recognize its importance.\n\nTodo:\n\n- Remove SSR in this version\n- Make sure all deps are up to date\n- Include the github package\n- Expose only one default export in the whole package\n\n\u003e React Mounter supports Server Side Rendering when used with [FlowRouter](https://github.com/kadirahq/flow-router).\n\nNormally, when you are rendering a React Component to the DOM, you need to do following things basically,\n\n- Create a root DOM node as the root node for React\n- Wait for the DOM to load properly\n- Then render the component\n\nReact Mounter does all these for you. You just ask it to render a component.\n\nAdditionally, React Mounter can work as a simple Layout Manager where you can use with [Flow Router](https://github.com/kadirahq/flow-router).\n\n## Basic Usage\n\nInstall with:\n\n```\nnpm i --save @olivierjm/react-mounter react react-dom\n```\n\n\u003e `react` and `react-dom` are peerDependencies of `@olivierjm/react-mounter`. So, you need to install them into your app manually.\n\nThen let's mount a component.\n\n```js\nimport React from 'react';\nimport { mount } from '@olivierjm/react-mounter';\n\nconst WelcomeComponent = ({ name }) =\u003e \u003cp\u003eHello, {name}\u003c/p\u003e;\n\nmount(WelcomeComponent, { name: 'Arunoda' });\n```\n\n## Using as a Layout Manager\n\nYou can user `@olivierjm/react-mounter` as a layout Manager for Flow Router. Here's how to do it.\n\nLet's say we've a layout called MainLayout.\n\n```js\nconst MainLayout = ({ content }) =\u003e (\n  \u003cdiv\u003e\n    \u003cheader\u003eThis is our header\u003c/header\u003e\n    \u003cmain\u003e{content}\u003c/main\u003e\n  \u003c/div\u003e\n);\n```\n\nNow let's try render to our `WelcomeComponent` into the `MainLayout`.\n\n```js\nmount(MainLayout, {\n  content: \u003cWelcomeComponent name=\"Arunoda\" /\u003e,\n});\n```\n\nThat's it.\n\n### To use the React Context\n\nIn order to use the React context, you need to render the `content` component inside the layout. So we need to pass a function instead of the React element. Here's how to do it.\n\n```js\nconst MainLayout = ({ content }) =\u003e (\n  \u003cdiv\u003e\n    \u003cheader\u003eThis is our header\u003c/header\u003e\n    \u003cmain\u003e{content()}\u003c/main\u003e\n  \u003c/div\u003e\n);\n```\n\n\u003e See, now content is a function.\n\nThen, we can pass the Welcome component like this:\n\n```js\nmount(MainLayout, {\n  content: () =\u003e \u003cWelcomeComponent name=\"Arunoda\" /\u003e,\n});\n```\n\n## Configure Root DOM node\n\nBy default React Mounter render our components into a DOM node called `react-root`. But, you can configure if by like below:\n\n```js\nconst {mount, withOptions} from `@olivierjm/react-mounter`;\nconst mount2 = withOptions({\n    rootId: 'the-root',\n    rootProps: {'className': 'some-class-name'}\n}, mount);\n\nmount2(WelcomeComponent, {name: 'Arunoda'});\n```\n\n## Server Side Rendering (SSR)\n\nSSR is supported when used with [FlowRouter SSR](https://github.com/kadirahq/flow-router/tree/ssr). Checkout this [sample app](https://github.com/kadira-samples/meteor-data-and-react).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkeduab%2Freact-mounter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsparkeduab%2Freact-mounter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkeduab%2Freact-mounter/lists"}