Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.






                const { useState, useCallback, memo } = React;

function PokeWorld({ pokemons }) {
  const [selected, setSelected] = useState(null);
  // Fonction commune à passer au composant enfant
  const handleClick = useCallback((pokemon) => {
  }, [pokemons]);

  return (
      <span>{selected &&}</span>
      <BigPokedexList pokemons={pokemons} handleClick={handleClick} />

// Composant mémoïsé qui n'effectuera de rendu que si la valeur props changent
const BigPokedexList = React.memo(({ pokemons, handleClick }) => {
  return (
      { => console.log(`render ${}`) || (
            // À chaque clic sur un bouton, le composant BigPokedexList et tous ses composants enfants sont rafraichit
          <button onClick={() => handleClick(pokemon)}>{}</button>

const pokemons = [{"name":"bulbasaur"},{"name":"ivysaur"},{"name":"venusaur"},{"name":"charmander"},{"name":"charmeleon"},{"name":"charizard"},{"name":"squirtle"},{"name":"wartortle"},{"name":"blastoise"},{"name":"caterpie"},{"name":"metapod"},{"name":"butterfree"},{"name":"weedle"},{"name":"kakuna"},{"name":"beedrill"},{"name":"pidgey"},{"name":"pidgeotto"},{"name":"pidgeot"},{"name":"rattata"},{"name":"raticate"},{"name":"spearow"},{"name":"fearow"},{"name":"ekans"},{"name":"arbok"},{"name":"pikachu"},{"name":"raichu"},{"name":"sandshrew"},{"name":"sandslash"},{"name":"nidoran-f"},{"name":"nidorina"},{"name":"nidoqueen"},{"name":"nidoran-m"},{"name":"nidorino"},{"name":"nidoking"},{"name":"clefairy"},{"name":"clefable"},{"name":"vulpix"},{"name":"ninetales"},{"name":"jigglypuff"},{"name":"wigglytuff"}];

ReactDOM.render(<PokeWorld pokemons={pokemons} />, document.getElementById("root"));