ACA 400 — Week 4 Interview Questions

Photo by Nathan Waters on Unsplash

Discuss in words something you learned in class today or this week.

We covered React Router, something instrumental for Single Page Applications. React is wonderful for creating SPA, and to be able to provide navigable urls we need to use Routes.

How does hoisting work in JavaScript?

Hoisting is using data before it is declared in Javascript. That’s a simplistic definition but it might look something like this.

hoisted = true;

console.log(hoisted) //outputs true

var hoisted;

Even though “hoisted” is declared after it is assigned “true” the console.log outputs “true”.

Javascript “hoists” all declared (not initalized) data to the top of the document when using var (or to the top of the fuction in a function scope).

ES6 let and const variable declaration makes hoisting impossible and that’s good. It’s cleaner and less difficult to follow the flow of the code.

Why is setState() in React Async instead of Sync?

As I quoted in the last set of interview questions from React deocumentation:

This ensures, for example, that if both Parent and Child call setState during a click event, Child isn’t re-rendered twice. Instead, React “flushes” the state updates at the end of the browser event. This results in significant performance improvements in larger apps.

How is the Virtual-DOM more efficient than Dirty checking?

It’s reusable, instead of re-rendering a whole page on information change Virtual Dom allows us to change/update in the DOM only what has been changed in the data.

What is PureComponent? When to use PureComponent over Component?

The easy answer is to prevent re-rendering of a child component when it’s parent component re-renders if the props on the child component do not change. It’s a way to improve performance.

What is a higher order component?

From React Documentation:

Concretely, a higher-order component is a function that takes a component and returns a new component.

Might look something like this:

const EnhancedComponent = higherOrderComponent(WrappedComponent);

While not exactly part of the React API per-se, HOC are a result of React’s compositional nature. HOC’s can be used to transform a component into a different component.

Which (if there is) node library method could you use to solve the algorithm problem you solved last night in your pre-homework.

…still enigmatic, still confusing. I need to know the algorithm.

Which (if there is) node library method could you use to solve the algorithm problem you solved in class tonight?

How do you think you might use the checkAuth() function to actually verify a user's email and password?

I’d imagine there would be checking against a database of email addresses. Probably paired with a fetch call to the database and a confirmation of existence in the database.

Austin Coding Academy

--

--

--

Comics artist and web developer located in Austin, TX telling stories and making up fantasy worlds for fun.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

OOP best practices that are anti-patterns in (functional) JavaScript

Web URL Routing and Deeplinking for React-Native apps using React-Navigation

Deploy (React.js, Github.io)

Deploying Strapi on Heroku

GraphQL with Express, MongoDB

Understand Babel family members with examples

JS Hacks

Dead Simple Infinite Scroll with Kaminari and React Waypoint

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sean Yager

Sean Yager

Comics artist and web developer located in Austin, TX telling stories and making up fantasy worlds for fun.

More from Medium

Why learning web development is not as hard as I thought!

Struggles of a Self-taught Developer that you as a Non-Developer should know

Coding at 30k feet

5 Best Coding Projects To Add To Your Portfolio And Actually Get Hired

coding projects to add to a portfolio