Creating cross-platform web-based applications with Ionic 4 and React is easy thanks to the Stencil compiler and create-react-app
.
In this video, we look at how to use create-react-app and @ionic/react to make an Ionic 4 + React application
Instructor: [00:00] To create an Ionic 4 application with React, we can start off with a create-react-app application using typescript. Next up, we'll need to install ionic/react, ionic/core, and because Ionic 4 relies on the react-router, we'll also need that too, as well as the react-router-dom and the surrounding types.
[00:26] At this stage, we can now go ahead and import from ionic/react. To test the application works correctly, let's import the IonApp, the IonHeader, the IonToolbar, and the IonTitle components.
[00:43] The root of an Ionic app should be an IonApp component. Inside of that, we'll have an IonHeader, the header can have an IonToolbar, and the toolbar can have an IonTitle. We'll call it as Ionic and React.
[01:01] Finally, if we wanted to add content under the header, we need to import the IonContent. If we run our application with npm start, we can see our Ionic and React application on screen.