Skip to content

Instantly share code, notes, and snippets.

View babaiyu's full-sized avatar
🤣
Ngapain Ngoding?

Bayu Permana Putra babaiyu

🤣
Ngapain Ngoding?
View GitHub Profile
@vicasas
vicasas / FieldArray.jsx
Created June 6, 2020 20:55
Example of how to create a dynamic array form using Formik 🙌
import React from "react";
import { Divider, Button, TextField } from "@material-ui/core";
import { makeStyles } from "@material-ui/core/styles";
import { FieldArray, Form, Formik, getIn } from "formik";
import * as Yup from "yup";
const validationSchema = Yup.object().shape({
people: Yup.array().of(
Yup.object().shape({
firstName: Yup.string().required("First name is required"),
@n1ru4l
n1ru4l / index.js
Created August 7, 2017 10:47
Fetch blob and convert to base64
export const fetchAsBlob = url => fetch(url)
.then(response => response.blob());
export const convertBlobToBase64 = blob => new Promise((resolve, reject) => {
const reader = new FileReader;
reader.onerror = reject;
reader.onload = () => {
resolve(reader.result);
};
reader.readAsDataURL(blob);