0% found this document useful (0 votes)
2 views

React (1)

Uploaded by

seheranabia22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

React (1)

Uploaded by

seheranabia22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Jokhon ekta image arektar upor overlap hoi tkhn oder parent ke relative kore jei

image ta niche thake overlap kore seta ke relative diye setar position fix korte
hobe jemon right top bottom left eshb posiiton

PROPS:
Properties are the optional input that your components can accept

To specify props for a component we specify them as attributes.

To generate token

**require(‘crypto’).randomBytes(64).toString(‘hex’)
Here is a list of some common HTTP status codes along with their meanings:

​ 1xx Informational:
●​ 100 Continue
●​ 101 Switching Protocols
●​ 102 Processing (WebDAV)
​ 2xx Success:
●​ 200 OK
●​ 201 Created
●​ 202 Accepted
●​ 204 No Content
●​ 206 Partial Content
​ 3xx Redirection:
●​ 300 Multiple Choices
●​ 301 Moved Permanently
●​ 302 Found (Temporary Redirect)
●​ 304 Not Modified
●​ 307 Temporary Redirect
●​ 308 Permanent Redirect
​ 4xx Client Errors:
●​ 400 Bad Request
●​ 401 Unauthorized
●​ 403 Forbidden
●​ 404 Not Found
●​ 405 Method Not Allowed
●​ 408 Request Timeout
●​ 409 Conflict
●​ 429 Too Many Requests
​ 5xx Server Errors:
●​ 500 Internal Server Error
●​ 501 Not Implemented
●​ 502 Bad Gateway
●​ 503 Service Unavailable
●​ 504 Gateway Timeout
●​ 505 HTTP Version Not Supported

It allows us to create a complex UI by making components


Jei component gulo resume kora jabe
Small and isolated code=components
Why react
1.Reusable component
2.Load fast
3.External plugin
4.Around 45% of worlds website use react
5.major brands like facebook,instagram use react
What is jsx?
-jsx stands for javascript XML
-JSX allows us to write and add HTML in react
Babel convert html code into ja

**components a value pass korte props use hoi

What is destructuring?
Destructuring was introduced in ES6. It’s a JavaScript feature that

allows us to extract multiple pieces of data from an array or object

and assign them to their own variables.

One of the essential features that make ReactJS a powerful tool is the way it
handles props. Props are properties that are passed down to components,
allowing for customization and dynamic rendering of data. Destructuring of
Props is a feature in ReactJS that makes it easier to handle props in
components.

const person = {
firstName: "Lindsay",
lastName: "Criswell",
city: "NYC"
}
const { firstName, lastName, city } = person;

—-----------------
**React Hooks
import React, { useState } from 'react';

function Example() {

// Declare a new state variable, which we'll call "count"


const [count, setCount] = useState(0);

return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</div>
);
}
Here, useState is a Hook (we’ll talk about what this means in a moment). We call it
inside a function component to add some local state to it. React will preserve this state
between re-renders. useState returns a pair: the current state value and a function that
lets you update it. You can call this function from an event handler or somewhere else.

**USECONTEXT
https://www.freecodecamp.org/news/context-api-in-react/

Basically, Context API consists of two main components: the context provider
and the context consumer. The provider is responsible for creating and
managing the context, which holds the data to be shared between components.
On the other hand, the consumer is used to access the context and its data from
within a component.

React Router
https://www.freecodecamp.org/news/a-complete-beginners-gu
ide-to-react-router-include-router-hooks/

React-query
https://tanstack.com/query/v3/docs/framework/react/overview

React-hook -form
React Hook Form is a library for managing form state and validation in React
applications using hooks. It offers a simple and efficient way to manage form data
without the need for complex state management libraries like Redux or MobX. Here
are some key features and use cases of React Hook Form:
​ Simplicity: React Hook Form provides a simple and intuitive API for managing
form state. It allows you to control form inputs with minimal boilerplate code.
​ Performance: It optimizes performance by reducing re-renders and
unnecessary component updates. React Hook Form uses uncontrolled
components and avoids re-rendering the entire form on every keystroke.
​ Validation: The library offers built-in validation support, allowing you to define
validation rules for form inputs easily. It supports both synchronous and
asynchronous validation.
​ Customization: React Hook Form is highly customizable and allows you to
define custom validation rules, error messages, and form submission
behaviors.
​ Integration: It seamlessly integrates with existing React components and
libraries. You can use it with UI libraries like Material-UI or Bootstrap without
any issues.
​ Optimized for React: React Hook Form is optimized for use with React
functional components and hooks. It embraces the React philosophy and
leverages React's built-in features to provide a lightweight and efficient
solution for form management.

Overall, React Hook Form is a powerful tool for managing forms in React
applications, offering simplicity, performance, and flexibility for developers.

React Prop types


React PropTypes is a mechanism for type checking in React applications. It helps in
ensuring that components receive the correct type of props during development. By
defining the expected types for props, PropTypes can detect potential bugs and
issues early on.

Here's how you can use PropTypes with an example:

​ Install PropTypes: First, you need to install the prop-types package if it's not

already included in your project.

​ bash

​ Copy code

npm install prop-types


​ Import PropTypes: Import PropTypes in your component file.
​ javascript

​ Copy code

import PropTypes from 'prop-types';


​ Define PropTypes: Use PropTypes to define the expected types for each prop

in your component.

​ javascript

​ Copy code

const MyComponent = ({ name, age }) => {


// Component logic
};

MyComponent.propTypes = {
name: PropTypes.string.isRequired,
age: PropTypes.number.isRequired,
};


​ Example Usage:

​ javascript

​ Copy code

import React from 'react';


import PropTypes from 'prop-types';

const Greeting = ({ name, age }) => {


return (
<div>
<h1>Hello, {name}!</h1>
<p>You are {age} years old.</p>
</div>
);
};

Greeting.propTypes = {
name: PropTypes.string.isRequired,
age: PropTypes.number.isRequired,
};

​ export default Greeting;

import React from 'react';


import PropTypes from 'prop-types';

const Greeting = ({ name, age }) => {


return (
<div>
<h1>Hello, {name}!</h1>
<p>You are {age} years old.</p>
</div>
);
};

Greeting.propTypes = {
name: PropTypes.string.isRequired,
age: PropTypes.number.isRequired,
};

export default Greeting;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy