Skip to content

Instantly share code, notes, and snippets.

View MartinL83's full-sized avatar
🤷‍♂️
wat

Martin Lindgren MartinL83

🤷‍♂️
wat
View GitHub Profile
@MartinL83
MartinL83 / react-bootstrap-breakpoints.js
Created November 19, 2017 20:47
A simple React HOC to feed css breakpoint data to a component.
import React, { Component } from 'react';
import _ from 'lodash';
/*
HOC to feed breakpoints data to child component.
Breakpoint data is based on Bootstrap's breakpoints
Using lodash throttle to optimize the high rate of events being fired.
*/
export const Breakpoints = (WrappedComponent) => {
@MartinL83
MartinL83 / react-ts-recursive.js
Last active November 14, 2022 17:37
React Typescript - Recursive component
import React, { useState } from "react";
type ItemType = {
id: Number;
title: String;
children: Array<Number>;
};
// Each "ItemType" element in the array have a array of children ID's. These refer
// to a ItemType.