Fireship · @fireship

Expo in 100 Seconds

Uploaded February 22, 2024 · Length 2:39

Expo in 100 Seconds

Summary

expo tutorial for building cross-platform mobile apps with react

  • expo
  • react native
  • cross-platform development
  • mobile app development
  • javascript

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    Expo an open source tool set for

  2. 0:02

    building Universal native apps on iOS

  3. 0:04

    Android and the web with a single react

  4. 0:06

    code base normally developers need to

  5. 0:08

    write Swift code for apple or cotlin for

  6. 0:10

    Android to build a mobile app and that

  7. 0:12

    sucks if you're a web developer because

  8. 0:14

    now you need to learn two new languages

  9. 0:16

    luckily react native fixes this by using

  10. 0:18

    a JavaScript bridge that allows react

  11. 0:20

    components to represent native UI

  12. 0:22

    components if the code looks like HTML

  13. 0:24

    and CSS but you're actually building

  14. 0:25

    truly native widgets the real deal not

  15. 0:28

    just a web view that's embedded in a

  16. 0:29

    native app and can interact with Native

  17. 0:31

    apis like the camera keyboard and

  18. 0:33

    vibrator pretty cool but here's where

  19. 0:35

    expo comes in first run this command to

  20. 0:37

    generate a project template it takes

  21. 0:39

    care of all the annoying configuration

  22. 0:40

    so you can start writing code right away

  23. 0:42

    inside this project we can use npm to

  24. 0:44

    instantly run this app on iOS Android

  25. 0:47

    and the web by simply running an npm

  26. 0:49

    command and if we go into the code and

  27. 0:51

    make some changes to the UI the app will

  28. 0:52

    hot reload to reflect the changes or you

  29. 0:54

    can test the app in a sandbox with tools

  30. 0:56

    like Expo go what's unique about this

  31. 0:58

    code though is this app Direct directory

  32. 1:00

    which uses file system based routing

  33. 1:02

    very similar to react Frameworks like

  34. 1:04

    nextjs and remix this allows you to

  35. 1:06

    create screens that are automatically

  36. 1:07

    deep linkable on mobile and you can

  37. 1:09

    navigate between them in the UI with the

  38. 1:11

    link component but on mobile platforms

  39. 1:13

    we navigate by pushing and popping

  40. 1:15

    screens to the navigation stack in Expo

  41. 1:17

    we can easily control that behavior with

  42. 1:19

    attributes like push and replace on the

  43. 1:21

    link or use the router module directly

  44. 1:23

    to navigate imperatively in addition the

  45. 1:25

    Expo router can also use layouts to

  46. 1:27

    share UI across multiple pages and also

  47. 1:29

    represent more advanced routing patterns

  48. 1:31

    like tabs and moduls Beyond routing

  49. 1:33

    though Expo provides tons of libraries

  50. 1:35

    for working with Native apis need a

  51. 1:37

    camera use Expo to install the camera

  52. 1:39

    package and simply use the camera view

  53. 1:41

    component in your UI the same goes for

  54. 1:43

    maps sensors and virtually every other

  55. 1:45

    use case and has Integrations with tools

  56. 1:48

    like Firebase and superbase to connect

  57. 1:50

    to backend Cloud infrastructure what's

  58. 1:51

    weird though is you'll notice our

  59. 1:53

    project is missing Android and iOS

  60. 1:55

    directories Expo developed a technique

  61. 1:57

    called continuous native generation

  62. 1:59

    where Native code is generated