Answers for "react react js"

0

react js

function Cart() {
    const monsteraPrice = 8
    const [cart, updateCart] = useState(0)
    const [isOpen, setIsOpen] = useState(false)
 
    return isOpen ? (
        <div className='lmj-cart'>
            <button onClick={() => setIsOpen(false)}>Fermer</button>
            <h2>Panier</h2>
            <div>
                Monstera : {monsteraPrice}€
                <button onClick={() => updateCart(cart + 1)}>
                    Ajouter
                </button>
            </div>
            <h3>Total : {monsteraPrice * cart}€</h3>
        </div>
    ) : (
        <button onClick={() => setIsOpen(true)}>Ouvrir le Panier</button>
    )
}
Posted by: Guest on June-25-2021
1

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>
  );
}
Posted by: Guest on April-12-2021
0

reactjs

{"id":28,"results":[{"id":"533ec651c3a368544800003e","iso_639_1":"en","iso_3166_1":"US","key":"ggX1DPfBLw8","name":"Josh Olson on APOCALYPSE NOW","site":"YouTube","size":720,"type":"Featurette"},{"id":"533ec651c3a368544800003d","iso_639_1":"en","iso_3166_1":"US","key":"CxENJ2LwecY","name":"Apocalypse Now redux - Trailer - HQ","site":"YouTube","size":480,"type":"Trailer"},{"id":"5619ceddc3a3681c28001101","iso_639_1":"en","iso_3166_1":"US","key":"yafLm-ByQWo","name":"Apocalypse Now : Redux - Alternate Trailer","site":"YouTube","size":720,"type":"Trailer"},{"id":"5b960ae80e0a26197302de0e","iso_639_1":"en","iso_3166_1":"US","key":"P-Z2mIKWFcg","name":"Apocalypse Now ≣ 1979 ≣ Trailer","site":"YouTube","size":1080,"type":"Trailer"},{"id":"5ce9507f925141669eb83d14","iso_639_1":"en","iso_3166_1":"US","key":"9l-ViOOFH-s","name":"APOCALYPSE NOW: FINAL CUT - Official Trailer - Dir. by Francis Ford Coppola","site":"YouTube","size":1080,"type":"Trailer"},{"id":"5d1a150aca4f67001ed720d5","iso_639_1":"en","iso_3166_1":"US","key":"gIUIefO_2x0","name":"APOCALYPSE NOW FINAL CUT - 4K Restoration in Theaters 8/15 & on 4K Combo Pack 8/27!","site":"YouTube","size":1080,"type":"Trailer"}]}
Posted by: Guest on July-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language