Skip to content

Instantly share code, notes, and snippets.

Instructions

Create a fork of this codesandbox and make all tests pass.

https://codesandbox.io/s/ts-code-test-gb912

  • You should edit src/index.tsx
  • Codesandbox has an automatic test runner which should tell you when your solution is working.
  • Firefox or Chrome are suggested, other browsers have been known to cause problems with the test runner in Codesandbox

If you have any questions, please send an email to [email protected], and send the URL of your submission to this email when you are done.

import { useState, useMemo } from "react";
type UseToggleInterface = [
boolean,
{
/**
* Set state value to `true`
*/
on(): void;
/**
import path from 'path'
import fs from 'fs'
function* getFilesRecursive(dir) {
const dirents = fs.readdirSync(dir, { withFileTypes: true });
for (const dirent of dirents) {
const res = path.resolve(dir, dirent.name);
if (dirent.isDirectory()) {
yield* getFiles(res);
} else {
const ethGasStationApiUrl = `https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey=`;
const req = new Request(ethGasStationApiUrl);
const res = await req.loadJSON();
if (config.runsInWidget) {
const widget = new ListWidget();
const textColor = Color.dynamic(Color.black(), Color.white());
const title = widget.addText("Gas Prices");
title.textColor = textColor;