Skip to content

georgestagg/webr-react-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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.

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 with your browser to see the result.

About

An example of running webR in a React application.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages