JavaScript Arrays are a very flexible data structure and used as lists, stacks, queues, tuples (e.g. pairs), etc. Some
Creating Arrays, reading and writing elements:
import { createContext, useContext, useRef } from 'react' | |
import { Button, Text } from 'tamagui' | |
import { createStore, useStore, type StateCreator, type StoreApi } from 'zustand' | |
const ViewModelContext = createContext<StoreApi<any> | null>(null) | |
const ViewModelProvider = <T,>({ | |
children, | |
initializer, | |
}: React.PropsWithChildren<{ initializer: StateCreator<T> }>) => { |
import { | |
queryByLabelText, | |
queryByRole, | |
queryByText, | |
} from "@testing-library/dom"; | |
import type { ByRoleOptions, Matcher } from "@testing-library/dom"; | |
const roles = [ | |
"alert", | |
"alertdialog", |
// usage examples | |
// callback | |
const err1 = await waitError(() => { /* do something that throws */ }) | |
// async callback | |
const err2 = await waitError(async () => { /* do something async that throws */ }) | |
// expect a promise instance to throw | |
const err3 = await waitError(promise) |
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
import foo from 'foo'
instead of const foo = require('foo')
to import the package. You also need to put "type": "module"
in your package.json and more. Follow the below guide.await import(…)
from CommonJS instead of require(…)
.<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Caesar Cipher</title> | |
<style type="text/css"> | |
body { | |
margin: 0 auto; | |
max-width: 40em; | |
width: 88%; |
This is tutorial of onfiguring eslint, prettier for your project
Make your code great again
First of all we need to install eslint and configs as dev dependencies. You can use your own config, but I will use config from airbnb:
yarn add -D eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react
module.exports = { | |
entry: { | |
main: path.resolve(__dirname, 'src/index.js'), | |
ProductList: path.resolve(__dirname, 'src/ProductList/ProductList.js'), | |
ProductPage: path.resolve(__dirname, 'src/ProductPage/ProductPage.js'), | |
Icon: path.resolve(__dirname, 'src/Icon/Icon.js'), | |
}, | |
output: { | |
path: path.resolve(__dirname, 'dist'), |
This worker script will evaluate your origin response, and replace html comments marked as fragment:key
with a respective prefetch defined in a X-Fragments
response header.
Your origin must include the X-Fragments
header, specifying the a comma separated list of prefetch requests to make for that response.
< HTTP/1.1 200 OK