Send a link to your students to track their progress
102 Terms
1
New cards
d
How do you declare a state variable called count and initialize it to zero in a functional component?
\ a. let \[count, setCount\] = useState(0);
b. let \[count\] = useState(0);
c. const \[count\] = useState(0);
d. const \[count, setCount\] = useState(0);
2
New cards
True
T or F
ReactJS is a library.
3
New cards
b
Which keyword creates a constant in JavaScript?
a. let
b. const
c. constant
d. var
4
New cards
b
What is the rule of thumb for when to use state in React?
\ a. Use state when you need to render your component to the DOM or manipulate the DOM elements directly
b. Use state when you need to store data that can change over time or affect the rendering of your component
c. Use state when you need to pass data from one component to another or share data across your application
d. Use state when you need to define the appearance and behavior of your component or handle user interactions
5
New cards
b
How do you update the state variable count to increase it by one in a functional component?
a. count++;
b. setCount(count + 1);
c. count = setCount(prevCount => prevCount + 1);
d. useState(count++);
6
New cards
b
What is the purpose of using state in React components?
a. To render the component to the DOM
b. To store data that can change over time
c. To define the appearance and behavior of the component
d. To pass data from one component to another
7
New cards
d
Who Develop React.js?
a. Google
b. Twitter
c. Microsoft
d. Facebook
8
New cards
c
What is the correct command to create a new React project?
a. npm create-react-app
b. npx create-react-app
c. npx create-react-app my-app
d. npm create-react-app my-app
9
New cards
b
What type of element will be rendered from the following code?
a. ReactDom
b. h1
c. Component
d. div
10
New cards
True
T or F
\ To develop and run React code, Node.js is required.
11
New cards
c
How do you initialize the state of a functional component?
a. By declaring a state variable and assigning an initial value
b. By using the setState hook and passing an initial value
c. By using the useState hook and passing an initial value
d. By assigning an object to this.state and passing an initial value
12
New cards
d
How does data in ReactJS flow?
a. two-way
b. one-way upwards
c. binding
d. one-way downwards
13
New cards
c
Which of the following is used to pass the data from parent to child?
a. children
b. state
c. props
d. hooks
14
New cards
d
A copy of the 'real' DOM that is kept in memory is called what? \n
a. DOM
b. React DOM
c. Shadow DOM
d. Virtual DOM
15
New cards
a, c, e
What is wrong with this code snippet? (multiple ans)
a. The keyword used for declaring a state.
b. JSX syntax
c. This component can't be imported.
d. This code snippet will throw an error.
e. The way the state is initialized.
16
New cards
a
How do you update the state of a functional component?
a. By calling the setter function returned by the useState hook and passing a new value or a function
b. By mutating the state variable directly
c. By using the setState hook and passing a new value or a function
d. By using the useState hook and passing a new value
17
New cards
ReactJS
__________ is an open-source JavaScript library for building user interfaces
18
New cards
Facebook in 2011
Who and when does reactJS created?
19
New cards
false, not a framework
t or f
\ ReactJS is a framework, but a library that focuses on the view layer of the application.
20
New cards
JSX and virtual DOM
ReactJS introduced the concept of ______ __&__ _________
21
New cards
JSX
_________ a syntax extension that allows writing HTML-like code in JavaScript
22
New cards
virtual DOM
_______ a technique for efficiently updating the Ul without manipulating the actual DOM.
ReactJS also uses components, which are reusable pieces of code that can render Ul elements and handle interactivity.
23
New cards
ReactJS
_______ is an open-source JavaScript library that allows developers to create user interfaces for web and mobile applications.
24
New cards
1. Facebook 2. Instagram 3. Netflix 4. Airbnb
ENUMERATION
\ websites that use ReactJS
25
New cards
faster and easier
Pros
\ ReactJS allows for **___** __**and**__ **_____ development of complex and dynamic web applications** with reusable components and state management.
26
New cards
virtual DOM
Pros
\ ReactJS enables better performance and user experience by using a **________** that only updates the changes in the real DOM, reducing the load on the browser.
27
New cards
server-side rendering
Pros
\ ReactJS **supports _____________**,. which can improve SEO and initial loading time of the web pages.
28
New cards
large and active
Pros
\ ReactJS has a **__** __**and**__ **___ community of developers** and a rich ecosystem of tools and libraries that can enhance Its functionality and compatibility.
29
New cards
steep learning curve
cons
\ ReactJS has a _________ and requires a good understanding of JavaScript, JSX, props, state, hooks, lifecycle methods, etc.
30
New cards
complete framework
ReactJS is **not a _________** and may need additional libraries or configurations for routing, testing, styling, etc.
31
New cards
compatibility issues
ReactJS may introduce s**ome __________ with older browsers** that do not support ES6 features or require polyfills.
32
New cards
frequent updates and changes
ReactJS may have **_____** __**and**__ **____** **in Its API** that can make it hard to keep up with the latest best practices and standards.
33
New cards
What do you mean by “ ReactJS is a library not a framework”
\ library - is a set of tools na pwd natun mashare, pwd ma import
framework - is a ecosystem of tools and a way of working. Mas completo ang framework kaysa sa library. A framework can have a multiple library
34
New cards
JSX
A super set of JavaScript. It is a JavaScript with new syntax.
35
New cards
Document Object Model
What is the acronym of DOM
36
New cards
True
t or f
React has a own memory of your application. So it will not look on your actual DOM in your browse, because react has it virtual DOM.
37
New cards
ReactJs
We use _____- in SPAs (Single page app) - so ang SPA nig adto nimo sa next na page dli niya e reload, mu retain lang sya and mu add some code of html
38
New cards
PWA
(Progressive web apps) - example spotify. So ang PDWAs kay SPA sya na pwede e cross platforms
39
New cards
traditional
A webpage tag ig navigate nimo, e reload niya tanan.
40
New cards
1. npx create-react-app
Enumeration
\ Steps in creating a react app
41
New cards
NPM
is a **package manag**er used to install, delete, and update JavaScript packages on your machine.
42
New cards
NPX
is a **package executer**, and it is used to execute JavaScript packages directly, without installing them.
43
New cards
Component
Also return a html
44
New cards
1. a component must return a HTML 2. You cannot return multiple JSX elements
Enumeration
\ Rules in JSX
45
New cards
npm start
Runs the app in the development mode.
46
New cards
npm start
The page will reload when you make changes. \n
47
New cards
npm start
Open http://localhost:3000 to view it in your browser.
48
New cards
npm start
You may also see any lint errors in the console.
49
New cards
npm test
Launches the test runner in the interactive watch mode.
50
New cards
npm run build
Builds the app for production to the `build` folder.
51
New cards
npm run build
It correctly bundles React in production mode and optimizes the build for the best performance.
52
New cards
npm run build
The build is minified and the filenames include the hashes. \n Your app is ready to be deployed!
53
New cards
npm run eject
this is a one-way operation. Once you `eject`, you can't go back!
54
New cards
npm run eject
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
55
New cards
npm run eject
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
56
New cards
npm run eject
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
57
New cards
downward
In react it is needed that we think __.
58
New cards
\+
Draw me a Virtual dom
59
New cards
true
T or F
We must avoid global variables
60
New cards
props
Like anhon nimo pag access sa iban na components or variables na ara sa iban na .js file, just use a ___
61
New cards
SyntheticEventObject
It is a react wrapper for a native browser event
62
New cards
False,once
React components are rendered twice.
63
New cards
States
Sa isa ka function, kaisa lang kita muReturn. So Unsaon pag force nga e reevaluate ni react ang enter component para e re-render balik.
64
New cards
const
We use ___ in setting a variable so that the user cant set the variable manually.
65
New cards
Lifting the state up
this is usually the solution in we want to share states.
66
New cards
true
T or f
Use effect and side effect are always could during render
67
New cards
README.md
The .md extension indicates the file is a markdown file. Markdown is a lightweight markup language with plain text formatting syntax. Many source code projects come with a README.md file that gives instructions and useful information about the project. When we push projects to platforms like GitHub, the README.md file usually displays information about the content contained in its repositories. Because you used create-react-app, your README.md should be the same as the official create-react-app GitHub repository²².
68
New cards
node_modules/
\: This folder contains all node packages that have been installed via npm. Since we used create-react-app, a couple of node modules are already installed. We’ll not touch this folder, since node packages are usually installed and uninstalled with npm via the command line.
69
New cards
• package.json
\: This file shows you a list of node package dependencies and other project configurations
70
New cards
package-lock.json
This file indicates npm how to break down all node package versions. We’ll not touch this file.
71
New cards
.gitignore
This file displays all files and folders that shouldn’t be added to your git repository when using git, as such files and folders should be located only in your local project. The node_modules/ folder is one example. It is enough to share the package.json file with others, so they can install dependencies on their end with npm install without your entire dependency folder
72
New cards
public/
This folder holds development files, such as public/index.html. The index file is displayed on localhost:3000 when the app is in development or on a domain that is hosted elsewhere. The default setup handles relating this index.html with all the JavaScript from src/.
73
New cards
Single-page applications
are popular for building web applications using frameworks like Angular, Ember, Knockout, Backbone, and React
74
New cards
Single-page applications
a user requests one minimal HTML file and one associated JavaScript file from the server, and the JavaScript renders the entire application with HTML and JavaScript for its interactions
75
New cards
src/ folder
The ___________ contains everything you need in the beginning.
\
76
New cards
src/App.js
The _________ file is used to implement React components and is the main focus.
77
New cards
src/App.test.js
· The ______________ file is for your tests and src/index.js is an entry point to the React world.
78
New cards
True
T or F
\ Variables defined **in the function'**s body will be **re-defined** each time this function runs.
79
New cards
true
T or f
· Variables **can be defined outside** of the App component if they are **not needed** within the component.
80
New cards
JSX
is a syntax that mixes HTML and JavaScript in the output of a React component
81
New cards
JSX
· follows the camelCase naming convention for HTML attributes, and replaces a few internal HTML attributes
82
New cards
JSX
__________________expressions can be used to display string primitives or JavaScript objects in the output
83
New cards
true
T or f
· Anything in curly braces in JSX can be used for JavaScript expressions, including function execution
84
New cards
map
· The list is defined as an array variable, with each item having several properties
· The_________ method is used to iterate over each item of the list and return a new version of each
· A JSX fragment is returned for each item of the list
85
New cards
key attribute
· The __________ is assigned to each list item's element for React to identify modified items if the list changes
86
New cards
true
t or f
\
· It is important to avoid using the index of the item in the array as the key attribute
87
New cards
Components
· ___________ can be organized into hierarchies, with one parent component and multiple child and sibling components.
88
New cards
root component
· The __________ is the top-level component in the hierarchy, and leaf components don't render any other components.
89
New cards
true
t or f
· JavaScript classes have constructors that assign arguments to class instances and define methods.
· Class definitions are the blueprint of its capabilities; usage occurs when an instance is created.
90
New cards
false, multiple
· React components also have one component definition but can have **single** component instances.
91
New cards
React DOM
is a library in React that lets us manipulate the DOM using React components.
92
New cards
ReactDOM.render()
· The ________ function is used to render React components into the DOM.
· The first argument of ___________ is the component or JSX to render.
· The second argument of ____________ is the HTML element where the React application will enter the HTML. This element should have an id='root'.
93
New cards
Arrow function
· ___________ expressions can be used more concisely, and the parentheses can be removed if there's only one argument.
· Defining React function components with ________ can make them more concise.
· _____________s without block bodies can be used if the function doesn't perform any tasks but only returns information.
94
New cards
event handler
· To use onchange handlers in JSX, define a function for the change event of the input field, called an ____________, and pass it to the onChange attribute of the input field.
95
New cards
synthetic event
· The _____________ is a wrapper around the browser’s native event, with more functions to prevent native browser behavior.
96
New cards
true
t or f
· JavaScript in HTML can display objects, pass JavaScript primitives to HTML attributes, and pass functions to an element’s attributes for handling events.
· Arrow functions are concise as event handlers, while function statements can give more visibility in a larger React component.
97
New cards
props
· _________ allow passing variables as information from one component to another component in React.
· Using _________, we can avoid using global variables in React components, which does not scale well.
98
New cards
False, props
t or f
\
· To use component, we first pass the variable to the child component via a prop attribute in JSX.
· The child component then receives the prop variable as an argument in its function signature, which can be accessed through the props object.
· Using component helps prevent polluting the global scope in React components.
99
New cards
Props
are used to pass information down the component tree