Skip to content

Instantly share code, notes, and snippets.

@JReinhold
JReinhold / machine.js
Last active April 8, 2021 07:40
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@JReinhold
JReinhold / combobox.jsx
Last active January 10, 2020 03:21
React Combobox aka. Auto Suggest field combining Formik, Material-UI and Downshift
import * as React from 'react';
import { StandardTextFieldProps } from '@material-ui/core/TextField/TextField';
import Paper from '@material-ui/core/Paper/Paper';
import MenuItem from '@material-ui/core/MenuItem/MenuItem';
import InputAdornment from '@material-ui/core/InputAdornment/InputAdornment';
import IconButton from '@material-ui/core/IconButton/IconButton';
import ArrowDropDown from '@material-ui/icons/ArrowDropDown';
import ArrowDropUp from '@material-ui/icons/ArrowDropUp';
import { TextField } from 'formik-material-ui';
import { Field, FieldProps, FormikProps } from 'formik';
@JReinhold
JReinhold / global-error-boundary.js
Last active May 3, 2023 18:36
example of a top-level ErrorBoundary component in React that handles React errors, event errors and async rejections.
import React from 'react';
/**
* A default ErrorBoundary that renders children, or if they produce an error, renders the passed
* onError() function, optionally with the error as a prop.
*/
export class GlobalSentryBoundary extends React.Component {
state = { reactError: undefined };
componentDidCatch(error, errorInfo) {