Skip to content

Instantly share code, notes, and snippets.

View erezsob's full-sized avatar

Erez Sobel erezsob

View GitHub Profile
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active June 20, 2024 02:08
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@erezsob
erezsob / language-culture-names-list.json
Last active January 8, 2024 09:00
List of language culture names and their display names as one level object in one JSON file
[
{
"country": "Afghanistan",
"language": "Pashto",
"twoLetter LangCode": "ps",
"threeLetterLangCode": "pus",
"cultureInfoCode": "ps-AF"
},
{
"country": "Afghanistan",
@erezsob
erezsob / tld-list.json
Last active July 10, 2017 13:04
All Top-Level-Domains as single level objects in one JSON file
{
".ac": "Ascension Island",
".ad": "Andorra",
".ae": "United Arab Emirates",
".af": "Afghanistan",
".ag": "Antigua and Barbuda",
".ai": "Anguilla",
".al": "Albania",
".am": "Armenia",
".an": "Netherlands Antilles",

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@martinaglv
martinaglv / 01.js
Last active May 10, 2019 07:03
What do these functions do?
function whatDoesItDo(val){
return val ? 1 : 2;
}
@staltz
staltz / introrx.md
Last active June 21, 2024 10:36
The introduction to Reactive Programming you've been missing