Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/georgestagg/webr-react-example
An example of running webR in a React application.
https://github.com/georgestagg/webr-react-example
Last synced: 3 months ago
JSON representation
An example of running webR in a React application.
- Host: GitHub
- URL: https://github.com/georgestagg/webr-react-example
- Owner: georgestagg
- License: mit
- Created: 2023-03-22T16:00:08.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-03T12:58:01.000Z (over 1 year ago)
- Last Synced: 2024-10-11T18:26:01.020Z (4 months ago)
- Language: JavaScript
- Size: 418 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Example of using webR in a React application.
This repo contains an example of using webR as part of a React application, originally bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
JavaScript source code showing an example of loading webR and using it in a page can be found in the file `src/App.js`.
A middleware proxy file, `src/setupProxy.js`, has been added to configure the app's Express instance so that the app is served with the recommended cross-origin isolation headers set. The same HTTP headers should be set on the hosting web server once the application has been build and deployed to production.
In addition, fallback worker scripts have been placed in the `public` folder so that if the page is not cross-origin isolated, webR will instead fall back to using a service worker for channel communication. Further information about cross-origin isolation and serving pages with webR can be found in the [webR documentation](https://docs.r-wasm.org/webr/latest/serving.html).
## Getting started
* Clone this repo and `cd` into the new directory.
* Install the required JavaScript libraries: `npm install`.
* Run the development server: `npm start`.Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.