Interview Prep Flashcards
What is React Js?
- a front end JavaScript library for building web and mobile user interfaces
- It was developed by Facebook in 2011
- React allows developers to build reusable UI components
- It has the support of a large, open source community
What are React components?
When it comes to using React, everything boils down to components.
Components are the building materials React uses to create website and application UI’s.
Components break a UI down into reusable parts (one of React’s core competencies). React then renders each UI component as needed (separately from the others), which is a big part of React’s fast performance speeds.
What is the difference between props and state?
“State” describes a default data value in a React component that can change over time (usually based on user actions that call for changes in a UI).
“Props” (or properties) describe the way a React component is configured. Props do not change.In summary: state is mutable (changeable based on user actions) while props are not
When would you use a class component over a functional component?
Functional components are the most basic kind of React component, defined by the components (unchanging) props. Class components are more complicated React components that allow developers to execute component lifecycle methods and manage a component's state. This means class components are used over functional components when you need to manage state or use component lifecycle methods
What are React events?
Events are reactions (the library IS called React, right?) that are triggered by specific user actions like clicking on a UI button, hovering a mouse over a UI object, using keyboard commands with the UI, etc.
What is JSX?
JSX is an HTML-like syntax that let’s developers write HTML style code in JavaScript, in case you prefer the readability of HTML to raw JavaScript
Developers do NOT need to use JSX to build websites or applications with React, but it can be a helpful tool for reducing overall code complexity (and Facebook encourages using it in their official React documentation)
After compilation, JSX expressions become regular JavaScript function calls and evaluate to JavaScript objects.
What are virtual DOMs and how do they work?
When web browsers render HTML documents and turn them into a website or application on a screen, they create a representational tree of how the site or app is arranged called a Document Object Model (DOM).
Without React, your website or app will use HTML to update its DOM in order to make things “change” on screen without users needing to manually refresh a page. React JS takes a different approach by creating a Virtual DOM—a copy of the site’s “actual” DOM.
React uses this copy to determine what parts of the actual DOM need to change based on a user’s action. React then takes the change date from the Virtual DOM and selectively updates the actual DOM (versus reloading the entire thing). Over time, this leads to significant performance improvements for the website or application.
What is the difference between React and React Native?
React JS is a front end, open source JavaScript library used for building UIs. React Native, on the other hand, is an open source, MOBILE framework that allows developers to use React on platforms like Android and iOS. “Native” is a reference to the fact that React Native integrates React components with the native capabilities of these mobile-specific platforms.
What are some of the major advantages of using React?
Increased application performance via the Virtual DOM model
Improved coding efficiency with JSX
The ability to reuse components across multiple projects
Flexibility and extensibility through add-on tools provided by React’s open source community
What are some of React’s limitations?
React JS is a JavaScript library and not a full-blown framework, meaning it might not be full service enough for some project
React’s library is extremely large and can take additional time and experience (past the initial learning phase) to really understand
JSX adds a new coding dimension for developers who haven’t used before (though it does have a gentle learning curve due to its similarity to HTML)
What is Redux?
Redux is a predictable state container for JavaScript apps.
It helps you write applications that behave consistently, run in different environments (client, server, and native), and are easy to test.
What is the difference between const, let, and var?
const is a constant, it is read only, and cannot be reassigned (the pointer cannot change). Objects assigned to a variable using const are still mutable - you can still add properties to objects or elements to an array
let allows the variable to be reassigned (changing pointer), when declared inside a block, statement, or expression, its scope is limited to that block, statement, or expression
var declares a variable globally, it can also be reassigned
Explain prototypical inheritance
Everything in JavaScript has a baseline object prototype that it inherits from. When you create an object based on its prototype, it will inherit the prototype’s properties and methods by default, but then you can overwrite them.
What does “this” mean in JavaScript
“this” refers to the context of everything that is available to access, so all the functions and objects that you currently can use
What is the data structure of the DOM?
tree