Skip to main content

Posts

ReactJS(v18) Form Validation | React Hook Form(v7) | React Bootstrap UI Form Components

In this article, we will understand the ReactJS form validation for React Bootstrap UI form components using the Rect Hook Form library. Create ReactJS Application: Let's create a simple ReactJS application to accomplish our demo. npx create-react-app name-of-your-app Install React Bootstrap Library: Let's install React Bootstrap UI library. npm install react-bootstrap bootstrap Import the bootstrap CSS file reference onto the  'index.js' file src/index.js: import 'bootstrap/dist/css/bootstrap.min.css'; Install React Hook From Library: Install the React Hook Form Library. npm install react-hook-form A Simple React Bootstrap Form Using React Hook Form Library: Let's create a simple Rect bootstrap Form and integrate the React Hook Form library to read the form data. src/App.js: import "./App.css"; import Row from "react-bootstrap/Row"; import Button from "react-bootstrap/Button"; import Col from "react-bootstrap/Col

ReactJS(v18) Form Validations | React Hook Form Library | Bootstrap

In this article, we are going to understand the form validation in the ReactJS application using the 'React Hook Form' library and bootstrap for UI design. Create ReactJS Application: Let's create the ReactJS application to accomplish our demo. npx create-react-app name-of-your-app Now install the bootstrap into our application. npm install bootstrap@5.2.1 Now import the bootstrap CSS file onto the 'index.js'. src/index.js: import 'bootstrap/dist/css/bootstrap.min.css' Install React Hook Form Library: Let's install the 'React Hook Form' library. npm install react-hook-form A Simple Form Using React Hook From Library: Let's implement a simple form in our 'App' component. src/App.js: import logo from "./logo.svg"; import "./App.css"; import { useForm } from "react-hook-form"; function App() { const { register, handleSubmit, formState: { errors }, } = useForm(); const onformS

ReactJS(V18) CRUD Example

In this article, we will implement CRUD operation in ReactJS(v18) application. ReactJS: ReactJS is a javascript library for creating user interface components. ReactJS components contains javascript function and they return JSX(JavaScript XML) as output. ReactJS effectively renders and update component on data changes. Create ReactJS(v18) Application: To create a ReactJS application our local machine should contain NodeJS. So go to 'https://nodejs.org/en/download/' Command to create ReactJS application npx create-react-app name-of-your-app Command to start the application. npm start Let's go through the project and explore important files. index.html: Inside the public folder we can see the index.html. Only the HTML file of the entire ReactJS application. It contained a 'div' element whose 'id' value is 'root', inside of this element all ReactJS components get rendered. index.js: Entry javascript file for ReactJS. It helps paint 'App' com

Part-7 | NestJS(v9) | Angular(v14) | MongoDB | CRUD Example

The main objectives of this article are: Create A HTTP Delete Endpoint In NestJS App Consume The Delete Endpoint In Angular App Create A HTTP Delete Endpoint In NestJS App: Let's implement the delete operation logic in 'SuperHeroesService'. NestJS_App/src/super-heroes/super-heroes.service.ts: async delete(id: string) { await this.superHeroModel.findByIdAndRemove(id); } Here 'findByIdAndRemove()' method deletes the document from the MongoDB collection. Let's add the HTTP Delete endpoint in our 'SuperHeroesController'. NestJS_App/src/super-heroes/super-heroes.controller.ts: import { Body, Controller, Delete, Get, Param, Post, Put } from '@nestjs/common'; import { SuperHeroes } from './schema/super-heroes.schema'; import { SuperHeroesService } from './super-heroes.service'; @Controller('super-heroes') export class SuperHeroesController { constructor(private superHeroService: SuperHeroesService) {} @Delete('/: