reactjs
yarn create react-app my-react-app
Strange Sandpiper
yarn create react-app my-react-app
A JavaScript library for building user interfaces
import React, { useState, useEffect } from 'react';
function Example() {
const [count, setCount] = useState(0);
// Similaire à componentDidMount et componentDidUpdate : useEffect(() => { // Met à jour le titre du document via l’API du navigateur document.title = `Vous avez cliqué ${count} fois`; });
return (
<div>
<p>Vous avez cliqué {count} fois</p>
<button onClick={() => setCount(count + 1)}>
Cliquez ici
</button>
</div>
);
}
// import { Link } from "react-router-dom";
import { IBlog as IProp } from "./useFetch"
const BlogList: React.FC<IProp> = ({ data }: IProp) => {
const renderList = () => {
return data.map((blogIndex) => {
return (
<div className='blog-preview' key={blogIndex.id}>
<a href={`/blogs/${blogIndex.id}`}>
<h2>{blogIndex.title}</h2>
<p>Written by {blogIndex.author}</p>
</a>
</div>
)
})
}
return (
<ul>
{renderList()}
</ul>
)
}
export default BlogList;
on React-Router 6.0 <Redirect /> changed to <Navigate />
Namaste
Angular is better ___GTFO