Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Create an Ionic 4 application with React

    Paul HallidayPaul Halliday
    reactReact
    ionicIonic

    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

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    Instructor: 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.

    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.

    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.

    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.

    Discuss

    Discuss