Interview Questions Flashcards
(42 cards)
What is React?
React is a Javascript framework/library. It lets you create UI’s from small isolated pieces of code called components, that can each have their own state.
What is Redux?
Redux is state management library that’s most commonly used with the React library.
How does Redux work?
Redux works by having a central store, that holds all of your applications state. Each component can have access to the state, without having to pass props up or down through components.
Redux setup process
Create a store that’ll hold your state and all your reducers, create reducers that’ll take in an action and change your state based on action, create actions that’ll pass payload and action to your reducers.
What are reducers in Redux?
Reducers in Redux are functions that take in two parameters: state/initial state, and an action. Based on what action is passed to the reducer, the reducer will then update the state and return a new state.
Why do you choose React?
In React you can create highly reusable components that can be used in different parts of a project.
Development time is quick, since there’s a lot less boilerplate setup needed.
What is AJAX?
Ajax is used to communicate with a server to send or receive data.
What is responsive design?
Responsive design is designing an application or website to be able to render correctly on different sized devices. So that it’ll look nice for the end user whether it be a phone or computer.
What is Restful API?
A Restful API is a web application that follows the REST principles of architecture.
What is the difference between REST API and RESTful API?
The Rest Api refers to the rule that can make an Api restfu. A RESTful API is an api that follows those rules that are part of the REST architecture.
What is the point of RESTful api?
The point of creating RESTful API’s is that it standardizes a set of rules that are used in many web services/applications to send and receive data and requests.
What is closure?
A closure is an inner function that has access to an outer functions scope.
What is a promise?
A promise is placeholder for a success value or failure reason, it is used in asynchronous methods that’ll return a value at some point in the future.
What is a callback?
A function that takes another function as a parameter, and uses that taken in function to complete some task.
What are the major features of React?
- React uses a virtual DOM that compares components previous states, and only updates the items whos state has changed, instead of rerendering/updating all of the components.
- React makes use of reusable components, that can be reused as many times throughout a project as needed.
- Unidirectional data flow- data flows in a downward pattern from parent to child.
What is jsx?
Jsx is an extension of React. It allows us to insert html into javascript, instead of the other way which is traditionally how it was done.
what is the virtual DOM? How does it work?
The virtual DOM is a copy of the real DOM. It works by rerendering the Virtual copy anytime data/state is changed, it then calculates the differences between this DOMand the previous dom. Once the calculations have finished the real DOM is updated with only the components/parts that have changed.
State versus Props
State are variables that are local to a component that can then be passed to other components(child components) that then become props that they can use.
What does lifting the state up mean and why do we do it?
Lifting up the state means having one common ancestor or parent that holds state and that state is true value of all the data. We do this to maintain data consistency across different components.
Why do we set a key property when we map over an array in React?
The main purpose is to help React distinguish between elements, and to help rendering when changing an element (changed, added, or removed.
What are the core principles of Redux?
- Single source of truth The global state of your application is stored in an object tree within a single store.
- State is read-only. The only way to change the state is to emit an action, an object describing what happened.
- Changes are made with pure functions called Reducers;
How do I make an Ajax request using redux?
You can make an ajax/ asynchronous request by using redux-thunk, which is middleware that allows you to do these requests in Redux.
What are the benefits of using Redux DevTools?
- Allows you to inspect each payload for status and action
- You can “cancel” actions going back in time
- If the gearbox code is changed, each action will be evaluated again “in stages”
- If the reducers launch then the error and the action in which it happened can be identified
- With the persistState () store enhancer, you can preserve debugging sessions on page reloads.
How do I use React DevTools? What does this help me with?
With React Developer Tools and the console, it is possible to modify rendered React components. This allows you to experiment with changing component values, calling methods, and testing interaction between components.
You can access and update a component’s state and props inside the Components tab.