Skip to content

OneSignalDevelopers/OneSignal-React-Sample

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

yarn start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

Quick Push Notification Setup In ReactJS

Follow this instructions to get stated with OneSignal.

In your ReactJS project folder, navigate to the public folder and open the index.html file. Inside of the head HTML tag, paste the code you previously copied from the OneSignal page. The code should look like this:

  <script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script>
  <script>
    window.OneSignal = window.OneSignal || [];
    OneSignal.push(function () {
      OneSignal.init({
        appId: "YOUR-APP-ID",
      });
    });
  </script>

Note: For advanced setup of OneSignal with ReactJS, reference the main branch.