React Redux Flashcards
1
Q
What is React?
A
- Open-source frontend Javascript library
- SPA (Single Page Application)
2
Q
What are the major features of React?
A
- Virtual DOM
- Unidirectional dataflow
- Reusability & composability
- — Lego bricks
- Isomorphic (server-side rendering)
- — Splits up the bundle for faster initial load
3
Q
What is JSX?
A
- Infused with Javascript & XML/HTML syntax
- — XML = markdown language
- — Syntactic sugar for creating elements
4
Q
What is the difference between a component & element?
A
- React mainly uses components
- Elements are the immutable version
5
Q
What is state?
A
- Holds information
- It can change over the lifetime of a component
6
Q
What are props?
A
- Inputs to components
- They are always passed down
- Unidirectional dataflow
7
Q
What is the difference between props & state?
A
- Locally, state can change
- — Props can’t
8
Q
What is the difference between HTML & React events?
A
- lowercase vs camelCase
- Native events vs Synthetic Events
9
Q
What are Synthetic Events?
A
- A wrapper around HTML native events
- So the Virtual DOM can track changes
10
Q
What are conditional expressions?
A
- Ternary (true ? ‘yes ‘ : ‘no’)
- &&
- ||
11
Q
What is ‘key’ used for?
A
- Unique key
- — Helps in fetching & changing that specific element
12
Q
What are refs?
A
- They provide a reference to a real DOM node
13
Q
How to create refs
A
- useRef hook
- React.createRef
14
Q
What is the Virtual DOM
A
- Javascript binary tree version of the DOM tree
- Listens for component events (Synthetic events)
- Selectively updates the real DOM instead of refreshing the entire thing
15
Q
What are controlled components?
A
- Component value is tracked by React state
- — Props
- — State
- — Context