Fireship · @fireship

React in 100 Seconds

Uploaded September 8, 2020 · Length 2:08

React in 100 Seconds

Summary

react basics: building user interfaces with react, props, state, and hooks in 100 seconds.

  • react
  • javascript
  • ui library
  • jsx
  • state management
  • hooks
  • front-end development

Transcript preview

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

  1. 0:00

    react a javascript library for building

  2. 0:02

    user interfaces developed at facebook

  3. 0:04

    and released in 2013 it's safe to say

  4. 0:06

    react has been the most influential ui

  5. 0:08

    library of recent memory we use it to

  6. 0:10

    build components that represent logical

  7. 0:12

    reusable parts of the ui the beauty of

  8. 0:15

    react is that the simplicity of building

  9. 0:17

    a component has been brought down to its

  10. 0:18

    theoretical minimum it's just a

  11. 0:20

    javascript function it's so easy a

  12. 0:22

    caveman could do it the return value

  13. 0:24

    from this function is your html or ui

  14. 0:27

    which is written in a special syntax

  15. 0:29

    called jsx allowing you to easily

  16. 0:31

    combine javascript with html markup if

  17. 0:33

    you want to pass data into a component

  18. 0:35

    you simply pass it a props argument

  19. 0:37

    which you can then reference inside the

  20. 0:38

    function body or in the ui using braces

  21. 0:41

    if the value changes react will react to

  22. 0:43

    update the ui if we want to give our

  23. 0:45

    component its own internal state we can

  24. 0:47

    use the state hook the hook is just a

  25. 0:49

    function that returns a value as well as

  26. 0:51

    a function to change the value in this

  27. 0:53

    case count is our reactive state and

  28. 0:56

    setcount will change the state when used

  29. 0:58

    in the template the count will always

  30. 0:59

    show the most recent value then we can

  31. 1:01

    bind set count to a button click event

  32. 1:03

    so the user can change the state react

  33. 1:05

    provides a variety of other built-in

  34. 1:06

    hooks to handle common use cases but the

  35. 1:09

    main reason you might want to use react

  36. 1:10

    is not the library itself but the

  37. 1:12

    massive ecosystem that surrounds it

  38. 1:14

    react itself doesn't care about routing

  39. 1:16

    state management animation or anything

  40. 1:17

    like that instead it lets those concerns

  41. 1:19

    evolve naturally within the open source

  42. 1:21

    community no matter what you're trying

  43. 1:22

    to do there's very likely a good

  44. 1:24

    supporting library to help you get it

  45. 1:26

    done need a static site you have gatsby

  46. 1:28

    need server side rendering you have next

  47. 1:30

    for animation you have spring for forums

  48. 1:32

    you have formic state management you've

  49. 1:33

    got redux mobx flux recoil x state and

  50. 1:36

    more you have an endless supply of

  51. 1:37

    choices to get things done the way you

  52. 1:39

    like it as an added bonus once you have

  53. 1:41

    reactdown you can easily jump into react

  54. 1:43

    native and start building mobile apps

  55. 1:45

    and it's no surprise that knowing this

  56. 1:46

    little ui library is one of the most

  57. 1:48

    in-demand skills for front-end

  58. 1:49

    developers today this has been react in

  59. 1:51

    100 seconds if you want to see more

  60. 1:53

    short videos like this make sure to like

  61. 1:55

    and subscribe and check out more

  62. 1:56

    advanced react content on fire ship i o

  63. 1:58

    and if you're curious how i make these

  64. 1:59

    videos make sure to check out my new