react-function-components Flashcards

1
Q

What is a React component?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you define a function component in React?

A

function keyword
function name w uppercased first letter
props argument
return keyword followed by jsx syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you mount a component to the DOM?

A

create a root
create an element with the type of the component name
pass that element to the render method of the root object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is the difference between a library

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly