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, { 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, { 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'; | |
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 { 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 { | |
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 { | |
CounterState, | |
decrement, | |
increment, | |
incrementByAmount, | |
testableCounterReducer, | |
} from "./testableCounterReducer"; | |
describe("testable counter reducer", () => { | |
const initialState: CounterState = { |
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 Counter = () => { | |
const count = useSelector((state: RootState) => state.counter.value) | |
return ( | |
<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 selectCount = (state: RootState) => state.counter.value; | |
export const selectCountFormatted = | |
(formatter: "$" | "%") => (state: RootState) => | |
`${formatter === "$" ? "$" : ""}${selectCount(state)}${ | |
formatter === "%" ? "%" : "" | |
}`; | |
export const selectCountAndStatus = (state: RootState) => | |
`The current count is ${selectCount(state)} and the status is ${ | |
state.counter.status | |
}`; |
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 { useSelector } from "react-redux"; | |
import {selectCountFormatted} from './selectors' | |
export const Counter = () => { | |
const countFormattedAsDollars = useSelector(selectCountFormatted('$')); | |
... |