Skip to content

Instantly share code, notes, and snippets.

View jeromeabel's full-sized avatar

Jérôme Abel jeromeabel

View GitHub Profile

ARIA hide/show content

Best practices to hide visual content and show it for screenreaders

.screenreader-only {
  border: 0 !important;
  clip: rect(1px, 1px, 1px, 1px) !important; /* 1 */
  -webkit-clip-path: inset(50%) !important;
 clip-path: inset(50%) !important; /* 2 */

RTK Query Primer

Redux Toolkit

File structure :

  • ./main.jsx
  • ./app/store.js
  • ./app/apiSlice.js
  • ./App.jsx
  • ./components/PokemonList.jsx

Redux Toolkit Primer #2 - Cart 🛒

Redux Toolkit

A simple example of a Cart to remind me the basic usage of Redux Toolkit. We need to use two features : "products" and "cart". The Products React Component displays a list of products and add it to the cart. The Cart Component displays the number of items and the total score.

File structure :

  • ./main.jsx
  • ./App.jsx
  • ./app/store.js
@jeromeabel
jeromeabel / rtk-primer-1.md
Last active February 24, 2023 10:27
Redux Toolkit Primer

Redux Toolkit Primer #1 - Counter 📖

Redux Toolkit

A simple example of a Counter to remind me the basic usage of Redux Toolkit. The Counter React component displays its value ("state") and allows to change it with three different buttons ("actions").

File structure :

  • ./main.jsx
  • ./App.jsx
  • ./app/store.js
@jeromeabel
jeromeabel / node-mongodb.md
Last active February 14, 2023 10:10
Node And MongoDB Primer

Node And MongoDB Primer

Installation

  • Install Node
  • Install MongoDB Driver locally or create a MongoDB Atlas account (see below)
  • Optional : install Compass

Create a project

$ mkdir project && cd project
@jeromeabel
jeromeabel / deploy-react-app.md
Last active June 1, 2023 12:58
Deploy React App On Github Pages

Deploy React App

Steps with Vite and React-router

On Github Pages

  • Install gh-pages : pnpm i -D gh-pages
  • Add scripts to package.json:
    • "build-for-deploy": "tsc && vite build && cp dist/index.html dist/404.html",
    • "predeploy": "yarn run build-for-deploy",
    • "deploy": "gh-pages -d dist",
  • Add homepage to package.json: