Starting React Again
Daily Standup
November 04, 2018
I’m starting React again! I did a class with React a while ago but I don’t think the instruction in that class matched up with how I can take things in. Now I’ve found a different course to use and started that today. Here are some of my notes for future reference:
Browser Dev Tools & React
One little shortcut I want to remember in the dev tools is the $0
trick…in dev tools if you click on an element, you can then reference that element in the browser by calling on $0
.
With the React dev tools installed (it’s a Chrome/Firefox extension), you can do something similar for React components and type $r
…it will show all the data attached to the object including props, state, etc. Sounds like this will be helpful with debugging in the future.
Basic React Component
import React from "react"; |
Note that if the point of this component is just to render the HTML above, it’s called a stateless functional component and can be written as a function instead:
const Header = props => ( |
Some JSX Gotchas
class
is a reserved word in React so to add a class attribute to an HTML element, you have to useclassName
- JavaScript and HTML comment syntax won’t work; comments have to be wrapped in curly braces and JS block comment syntax:
{ /* comment goes here */ }
Other Stuff
Actually I finished the course!
It was an all-day marathon but I’m glad I learned a lot. Now to try to apply it to GFT.
By the way I also got all the venues loaded into GFT this morning before starting React.
Up Next
Need to learn about using React with Postgres instead of Firebase (what we learned in the course), and how passing data will work in my app…then do it!