React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It’s ‘V’ in MVC. ReactJS is an open-source, component-based front-end library responsible only for the view layer of the application. It is maintained by
Facebook.
React uses a declarative paradigm that makes it easier to reason about your application and aims to be both efficient and flexible.
Features of React.js: There are unique features are available on React because that it is widely popular.
npx create-react-app myapp
import React, { Component } from 'react'
export class Contact extends Component {
render() {
return (
Contact
)
}
}
export default Contact
import React from 'react'
const Contact = () => {
return (
Contact
)
}
export default Contact
npm start
mkdir Utils Assets Components Config Layouts Middleware Pages Routes Services Utils
type NUL > sideBar.js
type NUL > Footer.js
type NUL > header.js
npm i react-router-dom
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
<Router>
<Routes>
<Route path="/" element={<Home />}/>
<Route path="" element={<Singlemovie />}/>
<Route path="*" element={<Errorpage />}/>
</Routes>
</Router>
According to the definition in React Router doc, useParams returns: an object of key/value pairs of URL parameters. Use it to access match.params of the current route
import { useParams } from 'react-router-dom'
const { id }=useParams();