Skip to content

Instantly share code, notes, and snippets.

import { useEffect, useRef } from 'react'
import { render } from 'lit-html'
export const RenderLit = ({ html }) => {
const container = useRef(null)
useEffect(() => {
const element = container.current
if (element) {
type Nullable<T, NullKeys = false> = NullKeys extends true ? { [key in keyof T]: null | T[key] } : T | null
import React from 'react'
import ReactDOM from 'react-dom'
import { MODAL_ID } from 'core'
import cx from 'helpers/cx'
import Button from 'components/Button/Button'
import s from './style.module.css'
interface ModalProps {
title?: string
import React from 'react'
import cx from 'helpers/cx'
import s from './style.module.css'
interface DiceProps {
number: number
}
const Dice: React.FC<DiceProps> = ({ number }) => (
interface ClassObject {
[className: string]: boolean | undefined
}
const addClass = (
collection: string,
className?: string,
statement: boolean = false
): string => {
if (className === undefined || className === '' || !statement) {
import { merge as dotPropMerge, set as setPropMerge } from 'dot-prop-immutable'
import { CaseReducer, PayloadAction } from '@reduxjs/toolkit'
type PropsNames<T> = Exclude<keyof T, symbol>
type DotPrefix<T extends string> = T extends '' ? '' : `.${T}`
type RecursivePropsNames<T> = {
[K in PropsNames<T>]: `${K}${DotPrefix<DotNestedKeys<T[K]>>}` | `${K}`
}[PropsNames<T>]
// Action Creator
type ActionCreator<P> = <A extends keyof P, TParams extends any[]>(
type: A,
prepare?: P[A] extends void ? undefined : (...args: TParams) => P[A],
) => (
...args: P[A] extends void ? [] : TParams extends undefined[] ? [payload: P[A]] : TParams
) => Action<A, P>
/**
* Function return action create helper that based on actions payloads interface.