export async getStaticProps
- Runs at build time only, meaning if there’s no
getInitialProps
, the page will be served as a static file (no SSR). - Can pass data to the page component as props.
- In development runs on every request
/** | |
* Convert a time string to a decimal value | |
* | |
* @param {string} argv e.g. 142h13m, 142 h 13 min | |
*/ | |
function run(argv) { | |
const query = argv[0]; | |
const [, hours, minutes] = query.match(/\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?/) | |
let decimal = 0; |
getInitialProps
, the page will be served as a static file (no SSR).#!/usr/bin/env bash | |
# References: | |
# https://docs.travis-ci.com/user/environment-variables | |
# | |
# Inspired by: | |
# https://gist.github.com/willprice/e07efd73fb7f13f917ea | |
# But using SSH keys instead of Personal Access Token: | |
# https://gist.github.com/alexilyaev/2672fe6d99756377fbffaabad6db1f45 |
Moment.js is now considered a legacy project (see Moment.js Project Status).
Here's a comparison between the alternatives:
trailingComma: es5
(default)https://prettier.io/docs/en/options.html#trailing-commas
When set to none
...
rem
units for font-size
and line-height
.
px
value of rem
to whatever we'd like.px
, %
or vw
for layout purposes.
margin
, padding
, width
, height
, etc.rem
here as well?any
as much as possible.
Record<string, unknown>
instead.unknown
instead.components/
NavBar/
BrandLogo.jsx
NavBar.jsx
NavBar.text.jsx
A really nice tool to manage the different Node.js/npm/yarn versions between projects: