Skip to content

Instantly share code, notes, and snippets.

View hadnazzar's full-sized avatar
:electron:
Force be with you.

Melih Yumak hadnazzar

:electron:
Force be with you.
View GitHub Profile
import React from "react";
import { useForm, SubmitHandler } from "react-hook-form";
interface IFormInput {
firstName: string;
lastName: string;
age: number;
}
export default function App() {
@hadnazzar
hadnazzar / react-hook-form.js
Last active October 7, 2021 23:03
React hook form tutorial
import React from "react";
import { useForm, SubmitHandler } from "react-hook-form";
type Inputs = {
example: string,
exampleRequired: string,
};
export default function App() {
const { register, handleSubmit, watch, formState: { errors } } = useForm<Inputs>();
import express, { Application , Request, Response} from 'express';
import nodemailer from "nodemailer";
const transporter = nodemailer.createTransport({
host: 'smtp.ethereal.email',
port: 587,
secure: false,
requireTLS: true,
auth: {
@hadnazzar
hadnazzar / index.tsx
Created August 12, 2020 10:31
Nextjs typescript layout index page
import Link from 'next/link'
import Layout from '../components/Layout'
const IndexPage = () => (
<Layout title="Home | Next.js + TypeScript Example">
<h1>Hello Next.js 👋</h1>
<p>
<Link href="/about">
<a>About</a>
</Link>
@hadnazzar
hadnazzar / Layout.tsx
Created August 12, 2020 10:21
next layout component with Typescript
import React, { ReactNode } from 'react'
import Link from 'next/link'
import Head from 'next/head'
type Props = {
children?: ReactNode
title?: string
}
const Layout = ({ children, title = 'This is the default title' }: Props) => (
@hadnazzar
hadnazzar / tsconfig.json
Created August 12, 2020 10:16
nextjs tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
<head>
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@flickr" />
<meta name="twitter:title" content="Small Island Developing States Photo Submission" />
<meta name="twitter:description" content="View the album on Flickr." />
<meta name="twitter:image" content="https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg" />
<meta property="og:url" content="http://www.nytimes.com/2015/02/19/arts/international/when-great-minds-dont-think-alike.html" />
<meta property="og:type" content="article" />
<meta property="og:title" content="When Great Minds Don't Think Alike" />
import React from 'react';
import {Scatter} from 'react-chartjs-2';
const data = {
labels: ['Scatter'],
datasets: [
{
label: 'My First dataset',
fill: false,
backgroundColor: 'rgba(75,192,192,0.4)',
import React from 'react';
import {Radar} from 'react-chartjs-2';
const data = {
labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'],
datasets: [
{
label: 'My First dataset',
backgroundColor: 'rgba(179,181,198,0.2)',
borderColor: 'rgba(179,181,198,1)',
import React from 'react';
import {Polar} from 'react-chartjs-2';
const data = {
datasets: [{
data: [
11,
16,
7,
3,