Wdf Unit 4 Digital Notes
Wdf Unit 4 Digital Notes
This document is confidential and intended solely for the educational purpose of
RMK Group of Educational Institutions. If you have received this document
through email in error, please notify the system manager. This document
contains proprietary information and is intended only to the respective group /
learning community as intended. If you are not the addressee you should not
disseminate, distribute or copy through e-mail. Please notify the sender
immediately by e-mail if you have received this document by mistake and delete
this document from your system. If you are not the intended recipient you are
notified that disclosing, copying, distributing or taking any action in reliance on
the contents of this information is strictly prohibited.
22IT407
WEB DEVELOPMENT FRAMEWORKS
(Lab Integrated)
Batch / Year / Semester: 2023-2027 / II / 4
4
1. CONTENTS
S.NO. CONTENTS PAGE NO
1 Contents 5
2 Course Objectives 6
3 Pre Requisites 7
4 Syllabus 8
5 Course Outcomes 13
6 CO- PO/PSO Mapping 14
7 Lecture Plan 15
8 Activity Based Learning 16
9 Lecture Notes 18-51
10 Assignment – 1 to 5 52-55
11 Part A Questions & Answers 56-59
12 Part B Questions 60
Supportive Online Certification 62
13
Courses
14 Real time Applications 63
15 Contents Beyond the Syllabus 65
16 Assessment Schedule 67
Prescribed Text Books & Reference 68
17
Books
18 Mini Project – 1 to 5 69-70
5
2. COURSE OBJECTIVES
OBJECTIVES:
6
3. PRE REQUISITES
• Pre-requisite Chart
22IT407
22CS102
-
SOFTWARE DEVELOPMENT PRACTICES
7
4. Syllabus
22IT407 – WEB DEVELOPMENT FRAMEWORKS (Lab Integrated) – L T P C - 3 0 2 4
6
4. Syllabus
2) Develop a Scientific calculator that does following operations
➢ Rounded Value
➢ Area of Circle
➢ Calculating of Sin, Cos and Tan functions
➢ Permiter of a Rectangle
➢ Employ Arrow functions
➢ Employ HOC
UNIT III - REACT COMPONENTS – 9+6
Class vs Functional Components, Lifecycle methods - React Class Based Components
– component DidMount, WillUpdate, shouldupate, didcatchetc - State - UseState,
UseRef, USeEffect, UseHistory Usage and Props(difference, when to use what,
mutable or immutabilty,direction of flow), PropTypes, Auxillary Components,
Controlled and Uncontrolled Components, Component Interaction (Parent to Child and
Child to Parent), Iteration & Conditional Response
List of Exercise/Experiments
1) Create a collection of Customer by using
➢ Weak Map and Map Collection in JS
➢ Show Case the different feature set of the same.
2) Add Login Page, Dash Board Page, Admin Page
➢ Enable React Routing
➢ Add React Protected Route, for authorization
UNIT IV - REACT LIBRARY – I – 9+6
Event Bubbleup - Component Wrapper - Integration of CSS Modules - Forms
Validations(YUP, Formik, Standard), Events Handling, Data Binding - Redux
List of Exercise/Experiments
1) Develop a React application that has User Registration Form w field
level validations, data submission to a rest api end point, boot strap for
responsive.
➢ Use YUP or Formik to implement the same.
4. Syllabus
2) Build a Redux Counter Application
Requirements:
➢ React application with Redux integrated.
➢ A counter with:
➢ Increment button
➢ Decrement button
➢ Reset button
➢ Display the current counter value.
UNIT V - REACT LIBRARY – II – 9+6
Custom Hooks, HTTP - Fetch, Axios, and Context API, Services, Behaviour Subjects -
StateLess, StateFulll and Container Components, Error Handling - Build, Env, CORS, Unit
Testing w React Testing Library - Introduction to react-native - Introduction to StoryBook
List of Exercise/Experiments
1) Employ backend API for Login Page functionality (authentication). Post login,
store the user context (received from the back end server) in browser’s session
storage as objects. And use the same as creds during protected route verification.
➢ On the dashboard page, have a grid of Students. The data has to be bought
from backend api
➢ Employ useref, useeffect & usestate, and useHistory
2) Enable Exception Handling
3) Enable HOC and Aux Components
4) Implement React-Testing Library
5) Basic Context Setup
Objective: Set up a React Context to manage theme (light or dark).
➢ Create a ThemeContext using React.createContext.
➢ Create a provider component ThemeProvider with state to toggle
between "light" and "dark" themes.
➢ Use the context in a functional component to display the current theme.
➢ Add a button to toggle the theme.
4. SYLLABUS
Business Use Case Implementations
3) E-Commerce System
4) Student LMS Management System
TOTAL:45+30=75 PERIODS
TEXTBOOK:
1. David Flanagan, Javascript The Definitive Guide, Paperback, 7th Edition, 2020.
2. David Choi ,Full-Stack React, TypeScript, and Node: Build cloud-ready web
applications using React 17 with Hooks and GraphQL Paperback – Import, 18
December 2020.
3. Mehul Mohan, Advanced Web Development with React Paperback – 1 January
2020.
E-RESOURCES:
1.Parental Website - https://reactjs.org/
2.The Road to Learn React: Your journey to master plain yet pragmatic React.js by
Robin Wieruch
3.Learning React: Functional Web Development with React and Redux by Alex Banks
and Eve Porcello
4. Learning React by KirupaChinnathambi
5. "React Up & Running" by StoyanStefanov
6. https://www.edureka.co/reactjs-redux-certification-training
7. CodePen
8. CodeSandbox (Preferred)
9. Stackblitz
11
4. SYLLABUS
LIST OF EQUIPMENTS:
• NodeJS (v9.11.2)
• Github as code repository
• Visual studio code as IDE
• RTL as unit testing framework
• Responsive design w bootstrap
• ReactJS installation (v17)
• Chrome / FIreFox Browsers (latest)
• Responsive using Media Queries & Bootstrap Material & Antdesign
• Design based Apps.
12
5. Course Outcomes
Course Outcomes with Knowledge Levels:
CO1: Personalize web pages using text formatting, graphics, audio,
and video. - K3
CO2: Hands on knowledge on Rest API , propTypes. - K3
CO3: Able to develop a web application using latest React
Framework – K3
CO4: Apply various React features including functions,
components, and services. – K3
CO5: Able to develop application using ReactJshooks. – K3
CO6: Design and integrate complex web components to enhance
user interface and user experience in React applications. – K5
11
6. CO-PO/PSO Mapping
CO2 3 2 3 1 2 - - - 2 1 - 1 3 3 1
CO3 3 3 3 1 2 - - 1 2 1 - 1 3 3 1
CO4 3 3 3 1 2 - - - 2 1 - 1 3 3 1
CO5 3 3 3 1 2 - - 1 2 1 - 1 3 3 1
CO6 2 3 3 - 3 - - 1 2 2 - 3 3 3 1
CO 2.83 2.83 3.00 1.00 2.00 - - 1.00 2.00 1.17 - 1.33 3.00 3.00 1.00
Correlation Level
1. Slight (Low)
2. Moderate (Medium)
3. Substantial (High) ,
If there is no correlation, put “-“.
12
7. LECTURE PLAN
Sl. Taxono
No. of. Proposed Actual Pertaining Mode of
No Topics my
Periods Date Date CO Delivery
. Level
As per As per
CO3, MD 1,
1 Event Bubbleup 1 academic academic K3
CO4,CO5 MD 4
calendar calendar
As per As per
Component CO3, MD 1,
2 1 academic academic K3
Wrapper CO4,CO5 MD 4
calendar calendar
As per As per
coIntegration of CO3, MD 1,
3 1 academic academic K3
CSS Modules CO4,CO5 MD 4
calendar calendar
As per As per
State - UseState, CO3, MD 1,
4 1 academic academic K3
UseRef, CO4,CO5 MD 4
calendar calendar
10 As per As per
CO3,
- Lab Exercises 6 academic academic K3 iamneo
CO4,CO5
15 calendar calendar
Common Activities
Inside the src folder, create a component EventBubble.js and add the following
code:
Step 2: Implement Event Bubbling in a Nested Component
import React from "react";
import "./EventBubble.css"; // Add CSS for better visualization
const EventBubble = () => {
const handleGrandParentClick = () => {
alert("Grandparent Clicked!");
};
const handleParentClick = (event) => {
alert("Parent Clicked!");
};
8. Activity Based Learning
const handleChildClick = (event) => {
alert("Child Clicked!");
};
return (
<div className="grandparent" onClick={handleGrandParentClick}>
<div className="parent" onClick={handleParentClick}>
<button className="child" onClick={handleChildClick}>
Click Me
</button>
</div>
</div>
);
};
export default EventBubble;
Step 3: Prevent Event BubblingModify the handleChildClick function to stop event
propagation:
const handleChildClick = (event) => {
event.stopPropagation(); // Prevents bubbling
alert("Child Clicked - Event Bubbling Stopped!");
};
Step 4: Style the Components (EventBubble.css)
.grandparent {
padding: 50px;
background-color: lightblue;
text-align: center;
}
8. Activity Based Learning
.parent {
padding: 30px;
background-color: lightcoral;
}
.child {
padding: 10px 20px;
background-color: yellow;
border: none;
cursor: pointer;
}
Step 5: Discussion & Reflection
Before using stopPropagation()
▪ Clicking the button triggers alerts in the following order:
▪ Child Clicked
▪ Parent Clicked
▪ Grandparent Clicked
After adding stopPropagation()
▪ Clicking the button only triggers the Child Clicked alert.
Lecture Notes
Binding- Redux
9. LECTURE NOTES
EVENT BUBBLEUP
In React, events can be "bubbled up" from child components to parent components. This
means that when an event occurs in a child component, it can be captured and handled
by a parent component. This behavior allows you to create complex interactions by
defining event handlers at various levels of your component tree.
For example, you might have a parent component that renders multiple child components,
and you want to handle a specific event that occurs in one of those child components at the
parent level.
You can achieve this by defining an event handler in the parent component and passing it
down to
the child component as a prop. When the event occurs in the child component, it can
trigger the event handler, which is defined in the parent component.
```javascript
import React from 'react';
function
ChildComponent(props) {
return (
<button onClick={props.onClick}>Click me</button>
);
}
function ParentComponent()
{ const handleButtonClick
= () => {
};
return( <div>
<h1>Parent Component</h1>
</div>
);
```
In this example, when you click the "Click me" button in the `ChildComponent`, the event
bubbles up to the `ParentComponent`, which handles the event by showing an alert.
A Higher-Order Component (HOC) is a pattern in React where you can create a new
component that wraps another component. This higher-order component enhances or
modifies the behavior of the wrapped component. HOCs are often used for tasks like code
reuse, state management, or adding additional props to a component.
Here's a simple example of a higher-order component:
```jsx
import React from 'react';
// A higher-order component that adds a "loggedIn" prop to the wrapped component.
const withAuth = (WrappedComponent) => {
return class extends React.Component { constructor(props) {
super(props);
this.state = this.state{
loggedIn: false,
};
}
componentDidMount() {
// Simulate authentication logic setTimeout(() => {
this.setState({ loggedIn: true });
}, 2000);
}
render() {
// Pass the "loggedIn" prop to the wrapped component
return <WrappedComponent {...this.props} loggedIn={this.state.loggedIn} />;
} };
};
// Usage: Wrap a component with the withAuth HOC const Profile = ({ loggedIn }) => {
return (
<div>
{loggedIn ? (
<h1>Welcome to your profile!</h1>
):(
<h1>Please log in to view your profile.</h1>
)}
</div>
);
};
const ProfileWithAuth = withAuth(Profile);
};
};
// Usage: Wrap a component with the withAuth HOC const Profile = ({ loggedIn }) => {
return (
<div>
{loggedIn ? (
<h1>Welcome to your profile!</h1>
):(
<h1>Please log in to view your profile.</h1>
)}
</div>
);
};
// Usage: Wrap a component with the withAuth HOC const Profile = ({ loggedIn }) => {
return (
<div>
{loggedIn ? (
<h1>Welcome to your profile!</h1>
):(
<h1>Please log in to view your profile.</h1>
)}
</div>
);
};
You can use higher-order components to encapsulate common functionality and apply it
to multiple components in your application, which promotes code reuse and
maintainability.
So, when you mention a "Component Wrapper," it's likely you are referring to this
concept of a higher-order component or a similar pattern where one component wraps
another to provide additional functionality or behavior.
CSS Modules are a popular way to encapsulate CSS styles in a modular and scoped
manner when
building applications with frameworks like React. They help prevent style conflicts and
make it easier to maintain and organize your styles. Here's how you can integrate CSS
Modules into your React application:
To use CSS Modules in a React project, you'll typically need to install a build tool like
Webpack and the appropriate loaders. Here's an example using npm:
```bash
```
These loaders are commonly used with Webpack to process CSS files and enable CSS
Modules.
If you haven't set up Webpack in your React project, you'll need to create or update your
Webpack configuration to include the CSS Modules configuration. Here's a simplified
example:
```javascript
// webpack.config.js
module.exports = {
// ... module: {
rules: [
test: /\.js$/,
},
'style-loader',
modules: {
format
},
},
},
],
},
],
},
// ...
};
In this example, we're using the `css-loader` with the `modules` option to enable CSS
Modules. The `localIdentName` option allows you to customize the format of the generated
class names.
Create CSS Module files:
In your project directory, create CSS files with the `.module.css` extension. For example,
`App.module.css`:
```css
/* App.module.css */
.header {
background-color: lightblue;
.button {
background-color: lightgreen;
Now, you can import and use CSS Modules in your React components:
```jsx
// App.js
<div>
<header className={styles.header}>Header</header>
</div> ); }
That's the basic integration of CSS Modules into a React project. With this setup, you
can create modular and scoped CSS styles for your React components, making it
easier to manage styles in larger applications without worrying about global conflicts.
Form validation is an essential part of building web forms, ensuring that user input is
accurate and meets specific criteria. There are several libraries and approaches you
can use for form validation in JavaScript and React. Three popular options are YUP,
Formik, and standard React form validation techniques:
1.Yup:
Yup is a schema validation library often used with Formik to handle form validation in
React applications. It provides a simple and declarative way to define validation
schemas and validate data.
Installation :
You can install Yup and Formik using npm or yarn:
```bash
npm install yup formik # or
yarn add yup formik
```
Usage :
- Define validation schema using Yup:
- ```javascript
- import * as Yup from 'yup';
- const validationSchema = Yup.object({
- name: Yup.string().required('Name is required'),
- email: Yup.string().email('Invalid email').required('Email is required'),
- });
- Use Formik to handle form state and validation:
```javascript
import { Formik, Form, Field, ErrorMessage } from 'formik';
function MyForm() { return (
<Formik
initialValues={{ name: '', email: '' }} validationSchema={validationSchema}
onSubmit={(values) => {
// Handle form submission here
}}
>
<Form>
<div>
<label>Name</label>
<Field type="text" name="name" />
<ErrorMessage name="name" />
</div>
<div>
<label>Email</label>
<Field type="email" name="email" />
<ErrorMessage name="email" />
</div>
<button type="submit">Submit</button>
</Form>
</Formik>
);
}
2.Formik:
Formik is a form library for React that simplifies form handling, including form validation,
form submission, and form state management.
Installation :
Install Formik as shown in the previous example.
Usage :
Formik handles form validation, state, and submission, as demonstrated in the previous
example.
3.Standard React Form Validation :
You can also perform form validation in React without external libraries by using
controlled components and managing validation logic manually. Here's an example:
```javascript
import React, { useState } from 'react';
function MyForm() {
const [formData, setFormData] = useState({ name: '', email: '' }); const [errors,
setErrors] = useState({});
Each of these approaches has its advantages, and the choice depends on your
specific project requirements and preferences. YUP and Formik offer a more
structured and declarative way to handle validation, while standard React validation
gives you full control but requires more manual work.
Event handling is a crucial aspect of web development, allowing you to capture and
respond to user interactions with a web page. In this explanation, I'll provide a
detailed overview of event handling in JavaScript, including examples for common
events.
EVENT BASICS
An event is a signal that something has happened, such as a user clicking a button,
moving the mouse, or pressing a key.
Event handling involves writing code (event handlers) to respond to these events.
Adding Event Listeners:
Event listeners are functions that "listen" for specific events on DOM elements and
execute code when those events occur.
You can attach event listeners to DOM elements using JavaScript.
Example 1: Click Event
In this example, we'll attach a click event listener to a button element and display an
alert when the button is clicked.
```html
<!DOCTYPE html>
<html>
<body>
<button id="myButton">Click Me</button>
<script>
// Get the button element by its ID
const button = document.getElementById("myButton");
// Add a click event listener to the button button.addEventListener("click", function ()
{
alert("Button clicked!");
});
</script>
</body>
</html>
Example 2: Mouseover and Mouseout Events
In this example, we'll use the `mouseover` and `mouseout` events to change the
background color of a div when the mouse enters and leaves it.
```html
<!DOCTYPE html>
<html>
<style> #myDiv {
width: 100px;
height: 100px;
background-color: lightblue;
}
</style>
<body>
<div id="myDiv">Hover over me</div>
<script>
const div = document.getElementById("myDiv");
div.addEventListener("mouseover", function () { div.style.backgroundColor =
"lightgreen";
});
div.addEventListener("mouseout", function () { div.style.backgroundColor =
"lightblue";
});
</script>
</body>
</html>
Example 3: Keydown Event
In this example, we'll use the `keydown` event to change the text of a paragraph
based on the key pressed.
```html
<!DOCTYPE html>
<html>
<body>
<p id="myParagraph">Press a key.</p>
<script>
const paragraph = document.getElementById("myParagraph");
`,
})
</script>
```
In this example, the `[(ngModel)]` syntax allows you to bind the input field's value
(`name`) to the data model and vice versa. If you change the input field's value, the
`name` variable is updated, and if you update `name`, the input field reflects the
change.
The specific implementation and syntax of data binding can vary depending on the
framework or library you are using. Angular, for instance, has its own way of
handling data binding, as demonstrated in the example above. React typically uses
one-way data binding, and Vue.js provides a combination of both one-way and two-
way data binding depending on how you structure your components.
React Redux
Redux was inspired by Flux. Redux studied the Flux architecture and omitted
unnecessary complexity.
• React Redux is the official UI bindings for react Application. It is kept up-to-date
with any API changes to ensure that your React components behave as expected.
Redux Architecture
React Redux is the official React binding for Redux. It allows React components to
read data from a Redux Store, and dispatch Actions to the Store to update data.
Redux helps apps to scale by providing a sensible way to manage state through a
unidirectional data flow model. React Redux is conceptually simple. It subscribes to
the Redux store, checks to see if the data which your component wants have
changed, and re-renders your component.
Redux was inspired by Flux. Redux studied the Flux architecture and omitted
unnecessary complexity.
• React Redux is the official UI bindings for react Application. It is kept up-to-date
with any API changes to ensure that your React components behave as expected.
Redux Architecture
STORE: A Store is a place where the entire state of your application lists. It manages
the status of the application and has a dispatch(action) function. It is like a brain
responsible for all moving parts in Redux.
ACTION: Action is sent or dispatched from the view which are payloads that can be
read by Reducers. It is a pure object created to store the information of the user's
event. It includes information such as type of action, time of occurrence, location of
occurrence, its coordinates, and which state it aims to change.
REDUCER: Reducer read the payloads from the actions and then updates the store
via the state accordingly. It is a pure function to return a new state from the initial
state.
Redux Installation
To use React Redux with React application, you need to install the below command.
It uses 'type' property to inform about data that should be sent to the Store. In this
folder, we will create two files: index.js and index.spec.js. Here, we have created an
action creator that returns our action and sets an id for every created item.
Index.js
let nextTodoId = 0
export const addTodo = text => ({
type: 'ADD_TODO',
id: nextTodoId++,
text
})
Step-4 Reducers
As we know, Actions only trigger changes in the app, and the Reducers specify
those changes. The Reducer is a function which takes two parameters 'Action' and
'State' to calculate and return an updated State. It read the payloads from the
'Actions' and then updates the 'Store' via the State accordingly.
In the given files, each Reducer managing its own part of the global State. The
State parameter is different for every Reducer and corresponds to the part of the
'State' it manages. When the app becomes larger, we can split the Reducers into
separate files and keep them completely independent and managing different data
domains.
Here, we are using 'combineReducers' helper function to add any new Reducers we
might use in the future.
index.js
import { combineReducers } from 'redux'
import todos from './todos'
import visibilityFilter from './visibilityFilter'
export default combineReducers({
todos,
visibilityFilter
})
Todos.js
const todos = (state = [], action) => {
switch (action.type) {
case 'ADD_TODO':
return [
...state,
{
id: action.id,
text: action.text,
completed: false
}
]
case 'TOGGLE_TODO':
return state.map(todo =>
(todo.id === action.id)
? {...todo, completed: !todo.completed}
: todo
)
default:
return state
}
}
export default todos
Todos.spec.js
import todos from './todos'
describe('todos reducer', () => {
it('should handle initial state', () => {
expect(
todos(undefined, {})
).toEqual([])
})
VisibilityFilter.js
import { VisibilityFilters } from '../actions'
Step-5 Components
It is a Presentational Component, which concerned with how things look such as
markup, styles. It receives data and invokes callbacks exclusively via props. It does
not know where the data comes from or how to change it. It only renders what is
given to them.
App.js
It is the root component which renders everything in the UI.
import React from 'react'
import Footer from './Footer'
import AddTodo from '../containers/AddTodo’
import VisibleTodoList from '../containers/VisibleTodoList'
const App = () => (
<div>
<AddTodo />
<VisibleTodoList />
<Footer />
</div>
)
export default App
Footer.js
It tells where the user changes currently visible todos.
import React from 'react'
import FilterLink from '../containers/FilterLink'
import { VisibilityFilters } from '../actions'
Link.propTypes = {
active: PropTypes.bool.isRequired,
children: PropTypes.node.isRequired,
onClick: PropTypes.func.isRequired
}
export default Link
Todo.js
It represents a single todo item which shows text.
import React from 'react'
import PropTypes from 'prop-types'
const Todo = ({ onClick, completed, text }) => (
<li
onClick={onClick}
style={{
textDecoration: completed ? 'line-through' : 'none'
}}
>
{text}
</li>
)
Todo.propTypes = {
onClick: PropTypes.func.isRequired,
completed: PropTypes.bool.isRequired,
text: PropTypes.string.isRequired
}
TodoList.js
It is a list to show visible todos{ id, text, completed }.
import React from 'react'
import PropTypes from 'prop-types'
import Todo from './Todo'
render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
)
Output
When we execute the application, it gives the output as below screen.
10. ASSIGNMENT – 1 To 5
1) ReactJS Form Validation using Formik and Yup packages is one good
validation. (CO3,K3)
Step 2: After creating your project folder i.e.react-form, move to it using the following
command:
https://www.geeksforgeeks.org/reactjs-form-validation-using-formik-and-yup/
2) Create a small example where initially have a simple form and then
https://dev.to/franciscomendes10866/react-form-validation-with-formik-and-yup-3676
3) For the demo, you will build a basic registration form with validations and
basic CSS styling (see the image below) nothing too fancy. (CO3,K3)
Prerequisites
Before we dive into the implementation, let’s ensure we have everything set up correctly.
https://olaishola.medium.com/mastering-form-validation-in-react-with-
formik-and-yup-with-typescript-9dc4b3885538
4) GitHub User Search: (CO4,K3)
In this project, you will use an input's value to search for users in GitHub using their
username or email.
How to build it
❑ You will first store the value typed into the input in a state value called query. After
that, you will perform an HTTP request to a GitHub API endpoint to then fetch the
users' profile which once again uses the browser fetch API. The request URL will use
❑ Once the results are fetched, we'll see how to display all the relevant info such as
❑ A good way to extend this project would be to attempt to allow search functionality as
the user types instead of having to submit the form first. Make sure to use a
debounce function to ensure that you do not too many requests to the GitHub API
This allows users to browse articles from various sources and save their favorites for later.
This project can be implemented using React and the NewsAPI to fetch news articles. To
show the list of articles, students can use the useEffect hook to fetch the data when the
component mounts and the Javascript map method to render a list of article items. To allow
users to select a source, students can use the useState hook to store the selected source in
the component’s state and render a dropdown menu with the available sources. To save an
article, students can use the useContext hook and the Context API to create a context for
3.Explain the difference between event bubbling and event capturing. (CO3,K2)
Event bubbling goes from the target element to its ancestors, while event capturing goes from
the top of the DOM hierarchy down to the target.
6.What are CSS Modules, and why are they used? (CO4,K2)
CSS Modules are a way to scope CSS styles to specific components, preventing style conflicts in
large web applications.
7.How do you define and use CSS Modules in a React application? (CO4,K2)
CSS Modules are defined by creating CSS files with the `.module.css` extension and then
importing and using them as objects in JavaScript.
13.How can you prevent the default behavior of an event in JavaScript? (CO4,K2)
You can prevent the default behavior of an event using the `event.preventDefault()`
method.
One-way data binding means that data flows from the data source to the UI but not in the
reverse direction.
These questions cover a range of topics related to event handling, component wrappers,
CSS Modules, form validations, event handling, and data binding in web development.
20.In React, what is the main advantage of using component wrappers (HOCs)?
(CO4,K2)
The main advantage is the ability to share and reuse behavior and state logic among
multiple components without duplicating code.
22.How do CSS Modules help avoid naming conflicts in CSS styles? (CO4,K2)
CSS Modules generate unique class names for each component, ensuring that styles don't
clash with styles from other components.
23.What is the naming convention for CSS Modules class names? (CO4,K2)
The naming convention typically includes a combination of the original class name, a hash, and
component-specific information to make it unique.
24. Explain the role of Yup in form validation with Formik. (CO5,K2)
Yup is used to define validation schemas for form fields in Formik, providing a powerful and
flexible way to validate user input.
28. In two-way data binding, how are changes in the UI propagated back to the data
model? (CO4,K2)
Changes in the UI are automatically reflected in the data model, ensuring synchronization
in both directions.
30.How does data binding enhance the user experience in web applications? (CO5,K2)
Data binding enhances the user experience by providing real-time updates to the UI based on
changes in the underlying data, creating dynamic and interactive web applications.
12. PART B : QUESTIONS
Q. CO
Questions K Level
No. Level
Explain the concept of event bubbling in JavaScript and its
1 significance in event handling. Provide examples to CO3 K2
illustrate how event bubbling works.
these techniques.
https://www.coursera.org/learn/react-basics
https://www.udemy.com/course/react-the-complete-
guide-incl-redux/learn/
https://cs50.harvard.edu/web/2020/
62
14. REAL TIME APPLICATIONS
At Spaculus, we can incorporate your new website design or we modify it and make it
responsive if you already own a website. Our team of experts uses various tools and
technologies to make your website more accessible such as media queries, flexible
grid based layouts that use re-sizing and flexible images & media.
jsx
return result;
};
65
15. CONTENT BEYOND SYLLABUS
This function takes three arguments: store, next (calls the next
Now, every action dispatched will be logged in the console, helping with debugging.
66
16. ASSESSMENT SCHEDULE
Name of the
S.NO Start Date End Date Portion
Assessment
As per schedule after
1 Unit Test 1 UNIT 1
Unit I completion
2 IAT 1 28.01.2025 03.02.2025 UNIT 1 & 2
163
67
17. PRESCRIBED TEXT BOOKS
&
REFERENCE BOOKS
TEXT BOOKS:
Full-Stack React, TypeScript, and Node: Build cloud-ready web applications using React 17
with Hooks and GraphQL Paperback – Import, 18 December 2020
REFERENCES:
The Road to Learn React: Your journey to master plain yet pragmatic React.js by Robin
Wieruch
Learning React: Functional Web Development with React and Redux by Alex Banks and Eve
Porcello
https://www.edureka.co/reactjs-redux-certification-training
CodePen,
CodeSandbox (ß Preferred)
Stackblitz.
18. MINI PROJECT SUGGESTION
An e-commerce website built using React and Typescript, where we can filter clothes
products using their customer preferred sizes as M, L or XL etc. We have a button called
“Add to cart” below each product shown on the web page, once user selects any product,
it will go to cart. At the end it can be used to checkout. These terms must be familiar to
everyone now-a-days since it tries to mock popular e-commerce websites like Amazon,
Flipkart and Myntra etc.
An e-commerce site allows users to browse and search for products, add them to a cart,
and check out using a dummy payment system. To build this app, you can create
a Product component that represents a single product and a ProductList component that
contains a list of Product components. The Product component should accept
information about the product, such as its name, price, and image, and render it along
with a Add to cart button. The ProductList component should accept an array of
products and render a Product component for each. You can also create
a Cart component that displays the items in the user’s cart and allows them to remove
items or check out.
A weather app shows the current weather for a given location. To build this app, you can
use the OpenWeatherMap API to fetch weather data for a given location. You can then
create a Weather component that accepts a location and displays the current temperature,
humidity, and other relevant information for that location. You can also add a search form
that allows users to enter a location and see the current weather for that location.
A recipe app allows users to search for recipes and save their favorites. To build this app,
you can use the Spoonacular API to fetch recipe data. You can then create
a Recipe component representing a single recipe and a RecipeList component containing a
list of Recipe components. The Recipe component should accept information about the
recipe, such as its name, ingredients, and instructions, and render this information user-
friendly. The RecipeList component should accept an array of recipes and render
a Recipe component for each. You can also add a search form that allows users to enter a
keyword and see a list of matching recipes.
This allows users to create and track tasks, set deadlines, and organize them into different
categories. This project can be implemented using React, React Hooks for state
management, and CSS for styling. To create tasks, students can use the useState hook to
store the list of tasks in the component’s state and render an input field where users can
enter their task description. To set deadlines, students can use the DatePicker component
from the react-datepicker library to allow users to select a date for their task.
Thank you
Disclaimer:
This document is confidential and intended solely for the educational purpose of RMK Group of
Educational Institutions. If you have received this document through email in error, please notify the
system manager. This document contains proprietary information and is intended only to the
respective group / learning community as intended. If you are not the addressee you should not
disseminate, distribute or copy through e-mail. Please notify the sender immediately by e-mail if you
have received this document by mistake and delete this document from your system. If you are not
the intended recipient you are notified that disclosing, copying, distributing or taking any action in
relianceon the contentsof this informationis strictlyprohibited.