Skip to content

Instantly share code, notes, and snippets.

View mhaecal's full-sized avatar

Muhaecal D. Khatami mhaecal

View GitHub Profile
@mhaecal
mhaecal / tsconfig.json
Created February 17, 2022 04:17
Typescript Configuration for React
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
@mhaecal
mhaecal / App.js
Last active February 28, 2022 04:11
React Query with Pagination Example
import React from 'react'
import Character from './components/Character'
import { QueryClientProvider, QueryClient } from 'react-query'
const queryClient = new QueryClient()
function App() {
return (
<div className="App">
<QueryClientProvider client={queryClient}>
@mhaecal
mhaecal / App.js
Created February 15, 2022 02:33
React Hook Form Validation with Error Message
import React from 'react'
import { useForm } from 'react-hook-form'
import { ErrorMessage } from '@hookform/error-message'
function App() {
// prettier-ignore
const { register, handleSubmit, formState: { errors } } = useForm()
const onSubmit = ({ username, password }) => {
alert(`Username: ${username}, Password: ${password}`)