Skip to content

Instantly share code, notes, and snippets.

import React, { useEffect, useState } from "react";
import { Card, CardColumns, Button } from "react-bootstrap";

function App() {
  const [data, setData] = useState([]);

  useEffect(() => {
    fetch("https://rickandmortyapi.com/api/character/")
 .then((res) => res.json())

Highlighting JavaScript Code

const express = require("express");
const app = express();
const port = 3000;

app.get("/", (req, res) => {
  res.send("Hello World!");
});

Indenting your code by four spaces

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {

res.send('Hello World!')

Fenced Code Blocks

const express = require("express");
const app = express();
const port = 3000;

app.get("/", (req, res) => {
  res.send("Hello World!");
});

Without any indents

const express = require("express"); const app = express(); const port = 3000;

app.get("/", (req, res) => { res.send("Hello World!"); });

import React from "react";
import Badge from "react-bootstrap/Badge";
let marked = require("marked");
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
markdown: "",
};
import React from "react";
import Badge from "react-bootstrap/Badge";
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
markdown: "",
};
}
import React from "react";
import Badge from "react-bootstrap/Badge";
export default class App extends React.Component {
render() {
return (
<div className="App">
<div className="container">
// grab the things we need ----------
const pokemonContainer = document.querySelector(".pokemon-container");
const formEl = document.querySelector("form");
const inputEl = document.querySelector("input[type=text]");
// listen for user events -------------
formEl.addEventListener("submit", (e) => {
e.preventDefault();
pokemonContainer.innerHTML = "";
getPokemon(inputEl.value);
razor-wind swords-dance cut bind vine-whip headbutt tackle body-slam take-down double-edge growl strength mega-drain
leech-seed growth razor-leaf solar-beam poison-powder sleep-powder petal-dance string-shot toxic rage mimic double-team
defense-curl light-screen reflect bide sludge skull-bash amnesia flash rest substitute snore curse protect sludge-bomb mud-slap
giga-drain endure charm swagger fury-cutter attract sleep-talk return frustration safeguard sweet-scent synthesis hidden-power
sunny-day rock-smash facade nature-power ingrain knock-off secret-power grass-whistle bullet-seed magical-leaf natural-gift
worry-seed seed-bomb energy-ball leaf-storm power-whip captivate grass-knot venoshock round echoed-voice grass-pledge work-up
grassy-terrain confide