“react.js” Code-Antworten

Reactjs

yarn create react-app my-react-app
Strange Sandpiper

react.js

A JavaScript library for building user interfaces
Fun Bee

Reactjs

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>
  );
}
Relieved Raccoon

react.js

// 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;
Angry Antelope

reagieren js

on React-Router 6.0 <Redirect /> changed to <Navigate />
Ahtesham ul haq

Ähnliche Antworten wie “react.js”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen