react-function-components Flashcards
What is a React component?
React components are sort of like JavaScript functions. they take in arguments (props) and return react elements describing what should be on the screen
core definition: a reusable class or function that returns a react element that represents a sections of your UI.
How do you define a function component in React?
function keyword
function name w uppercased first letter
props argument
return keyword followed by jsx syntax
How do you mount a component to the DOM?
create a root
create an element with the type of the component name
pass that element to the render method of the root object
what is the difference between a library
the differences lie between IOC - inversion of control
- a library is code that you call
- YOU call THEM
- a framework calls your cold
if you are defining functions and classes but not calling them yourselves, you are using a framework. but frameworks are a subset of libraries