Posted in interview, Interview, Javascript, js, React Quize, Reactjs, Vuejs React Basics Quiz Results #1. Which kind of code do you write when using React.js? Definitive JSX Code Imperative JavaScript Code Declarative JavaScript Code #2. What is “JSX”? It’s a standard JavaScript syntax It’s a special, non-standard syntax which is enabled in React projects It’s a special string which you can pass to React functions #3. Why is React all about “Components”? Every UI in the end up is made up of multiple building blocks (= components), hence it makes sense to think about user interfaces as “combinations of components” React projects are configured to only work with components, hence you have to use them when writing React code. Components offer better performance than “standard user interfaces” that don’t use components. #4. What does “declarative” mean? “Declarative” is the same as “imperative” You define the individual steps that need to be taken to achieve a desired outcome (e.g. a target UI). You define the desired outcome (e.g. a target UI) and let the library (React) figure out the steps. #5. What is a “React Component” ? It’s a JavaScript function which typically returns HTML (JSX) code that should be displayed. It’s a replacement for standard HTML which is supported by modern browsers. It’s a JavaScript function that must not return anything. #6. How many custom React components must a React app have? At least 3 At most 999 That’s totally up to you #7. Which statement is correct? With React, you build multiple sibling component trees that are then mounted into the same DOM node. With React, you build a component tree with one root component that’s mounted into a DOM node. With React, you always mount every component into it’s own DOM node. #8. What does “component tree” mean? It means that you have a root node which then has more components nested beneath it. It means that you must always return more than one component or HTML element per component function. It means that you can build multiple components. #9. How do you pass data between components? Via global JavaScript variables that are accessible in all files Via “custom HTML attributes” (better known as “props”) Via standard HTML attributes which you can use in non-React apps as well #10. How can you output dynamic data in React components (i.e. in the returned JSX code)? You can use single curly braces (opening & closing) with any JS expression between them. React has a special syntax that allows you to output variable values (i.e. values stored in variables) and nothing else: Opening & closing curly braces You can’t Previous Finish Related Articles Drawbacks of ChatGPT Chartered Accountant Interview Questions Top AWS Interview questions and Answers React – What to add & Not to add as Dependencies