This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
PayloadAction, | |
createReducer, | |
} from "@reduxjs/toolkit"; | |
import { increment, decrement, incrementByAmount, incrementAsync } from "./actions"; | |
export interface CounterState { | |
value: number; | |
status: "idle" | "loading" | "failed"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Contact, UserForm } from '../user-form/userForm'; | |
import React, {FC, useState} from 'react'; | |
export const CreateProspect: FC = () => { | |
const [user, setUser] = useState<Contact>({ | |
name: '', | |
email: '', | |
phoneNumber: '', | |
referredBy: '' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FC } from 'react'; | |
export interface Contact { | |
name: string, | |
email: string, | |
phoneNumber: string, | |
referredBy?: string, | |
role?: string, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FC } from 'react'; | |
import styles from './createUser.module.css'; | |
import { useParams } from 'react-router-dom' | |
export interface Contact { | |
name: string, | |
email: string, | |
phoneNumber: string, | |
referredBy?: string, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FC } from 'react'; | |
import styles from './createUser.module.css'; | |
export interface Contact { | |
name: string, | |
email: string, | |
phoneNumber: string, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export const Grid = (props) => { | |
const renderRow = (rowData) => ( | |
<div className="row"> | |
<div className="col"> | |
{rowData.title} | |
</div> | |
<div className="col"> | |
{rowData.description} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { status, labels } from './status'; | |
export const Badge = (props) => { | |
return ( | |
<div style={ | |
{backgroundColor: props.status === status.active ? 'green' : 'red'} | |
}> | |
{labels.statusPrompt[props.language]}: {props.status} | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const status = { | |
active: 'Ready', | |
inactive: 'Inactive' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export const Badge = (props) => { | |
return ( | |
<div style={ | |
{backgroundColor: props.status === 'active' ? 'green' : 'red'} | |
}> | |
Status: {props.status} | |
</div> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MutableRefObject, useMemo, useRef } from 'react'; | |
export const useDebounce = (milliseconds: number) => { | |
const clearable: MutableRefObject<number | undefined> = useRef(); | |
const debounce = useMemo( | |
() => (fn: () => Promise<void>) => { | |
if (clearable.current !== undefined) { | |
clearTimeout(clearable.current); | |
} |