Skip to content

Instantly share code, notes, and snippets.

function insert(array, rightIndex, value) {
for (var j = rightIndex; j >= 0 && array[j] > value; j--) {
array[j + 1] = array[j];
}
array[j + 1] = value;
}
function insertionSort(array) {
for (var i = 1; i < array.length; i++) {
insert(array, i - 1, array[i]);
@mcmxc
mcmxc / app.js
Created January 8, 2020 12:21
react-phone-number-input + ant design (antd) Input
import React, { useState, useCallback, forwardRef } from 'react';
import { Input } from 'antd';
import PhoneInput from 'react-phone-number-input/min';
import 'react-phone-number-input/style.css';
const PhoneInputComponent = forwardRef(({ onChange, ...props }, ref) => {
const handleChange = useCallback(e => onChange(e.target.value), [onChange]);
return <Input ref={ref} {...props} onChange={handleChange} />;
});