{"id":13624923,"url":"https://github.com/web-perf/react-worker-dom","last_synced_at":"2025-04-16T01:32:57.817Z","repository":{"id":57347822,"uuid":"46694185","full_name":"web-perf/react-worker-dom","owner":"web-perf","description":"Experiments to see the advantages of using Web Workers to Render React Virtual DOM","archived":false,"fork":false,"pushed_at":"2017-02-06T23:20:21.000Z","size":1747,"stargazers_count":943,"open_issues_count":6,"forks_count":51,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-04-15T21:49:15.336Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://web-perf.github.io/react-worker-dom","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/web-perf.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2015-11-23T03:21:29.000Z","updated_at":"2025-03-30T00:42:19.000Z","dependencies_parsed_at":"2022-08-28T01:40:22.768Z","dependency_job_id":null,"html_url":"https://github.com/web-perf/react-worker-dom","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-perf%2Freact-worker-dom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-perf%2Freact-worker-dom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-perf%2Freact-worker-dom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-perf%2Freact-worker-dom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/web-perf","download_url":"https://codeload.github.com/web-perf/react-worker-dom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249182479,"owners_count":21226074,"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-08-01T21:01:48.225Z","updated_at":"2025-04-16T01:32:57.804Z","avatar_url":"https://github.com/web-perf.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Web (+ NW \u0026 Electron)"],"sub_categories":[],"readme":"# React Renderer using Web Workers\n\nA React Custom renderer using Web Workers. All the Virtual DOM reconcilliations happen in a WebWorker thread. Only node updates are sent over to the UI thread, result in a much more responsive UI.  \n\nAn existing React application can leverage WebWorkers using this library with minimal change. Look at the usage section for details. \n\n## Demo\n\nThe demo is hosted at [http://web-perf.github.io/react-worker-dom/](http://web-perf.github.io/react-worker-dom/). To run a local version of the demo, \n\n- Clone the repo run `npm install` to install all dependencies.\n- Build the app using `npm run demo`\n- Open `http://localhost:8080/test/dbmonster/` to view the demo app, or `http://localhost:8080/test/todo` for the todo app.\n- Tweak the params in the URL to change to use web workers, increase number of components, etc. \n\n## Usage\n\n### A typical React application\n\nA typical React application would looks something like the following.\n\n```js\n// File: main.jsx\nimport React from 'react';\nimport reactDOM from 'react-dom';\nreactDOM.render(\u003cComponent/\u003e, document.getElementById('container'));\n```\n\n### Using it with Web Workers\n\nTo use this renderer, we would need to split the above file into 2 parts, one that is on the page, and another that starts as a web worker. \n\n\n```js\n// File: main.js - included using a script tag in index.html\nimport React from 'react';\nimport reactDOM from 'react-worker-dom'; // Instead of using react-dom\nreactDOM.render(new Worker('worker.js'), document.getElementById('container'));\n```\n\nThe `worker.js` file is the one that now holds the actual Component. \n\n```js\n// File: worker.jsx - loaded in index.html using new Worker('worker.jsx') in the file script above; \nimport React from 'react';\nimport ReactWorkerDOM from 'react-worker-dom-worker';\nReactWorkerDOM.render(\u003cComponent/\u003e);\n```\n\nLook at `test\\dbmonster` and `test\\todoapp` directory for the examples. \n\n## Testing Performance\n\nTo manually look at frame rates, load the dbmonster [demo pages](http://web-perf.github.io/react-worker-dom/) in Chrome, and view the [frame meter](https://developer.chrome.com/devtools/docs/rendering-settings#show-fps%20meter) in devtools.\n\nTo automatically collect frame rates and compare it with the normal version\n- Run `npm run demo` to start the server and host the web pages\n- Run `npm run perf chrome worker` to test frame rates for various rows in chrome in a Web Worker. Instead of `chrome`, you could use `android`, and instead of `worker`, you could use `normal` to test the other combinations.\n- The frame rates are available in `_dbmonster.json` file, for each row count. \n\n## Roadmap\nHere are the things that need to be done next. \n\n- Add support for form elements like `\u003cinput\u003e`, `\u003cselect\u003e`, etc.\n- Support event utilities that enable things like autofocus, etc. \n- Enable preventDefault() semantics in events. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb-perf%2Freact-worker-dom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweb-perf%2Freact-worker-dom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb-perf%2Freact-worker-dom/lists"}