I’ve Cracked the Code, Please Call Tech Support- Episode 25, The Forms Unleashed II: No Subtitle Because There Wasn’t One

Truth be told, React is a whole different beast to learn. However, it is a powerful tool that, when mastered, can do some really rad stuff.

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

Collaboration is key. We had a project where we needed to manipulate data in an API, which is something that we have worked on before. However, with this being a whole new language, everyone is struggling a bit to keep up.

By working with a couple of other coders (who are fantastic at what they do), we were able to get everything up and running, whereas if we were alone, it might have taken more time than we had. I’m talking days.

2. What is the difference between between state and props?

As per kentcdodds.com, props (which is short for properties) is an object that a React function accepts as its first argument. State, however, is data that changes over the lifetime of a specific instance of a React component.

3. What is ReactDOM? What is the difference between ReactDOM and React?

ReactDOM is a package that provides DOM-specific methods that can be used at the top level of your app. These are things like render(). React is a JavaScript library that is a tool for building entire UI components.

4. What is React.createClass?

React.createClass allows us to create component classes, which can take in things like a state in order to reflect what we want our app to do under particular conditions. This is done more effectively now by simply using “extends React.Component”.

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

preventDefault is a very handy method for forms. Basically it prevents the form from performing it’s regular action, in this case, preventing it from reloading the page when the submit function is pressed.

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

A combination of setState and preventDefault were very handy in solving our form submissions. It allowed us to set the state of the form to either search by author or story, as well as date, using a dropdown. By preventing the ppage from reloading, we could then display the results to the user.

7. Explain event delegation in JavaScript and why it is useful.

Event delegation allows us to handle many elements in a similar way, by using event.target. This let’s us write much less code, as they are being handled using similar methods.

8. Which new JavaScript / browser features are you most excited about and why?

I’ve written about the setState feature many times, and there’s a reason for that. Setting the state allows us to more intuitively speak to our app, and get it to work within the conditions that we want. This will help with a ton of coding projects moving forward.