Skip to content

Instantly share code, notes, and snippets.

View ty-everett's full-sized avatar

Ty Everett ty-everett

View GitHub Profile
@ty-everett
ty-everett / game.html
Created May 10, 2024 05:40
Payment Guessing Game
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Price Guessing Game</title>
<style>
body {
display: flex;
flex-direction: column;
import LockingScript from './LockingScript.js'
import UnlockingScript from './UnlockingScript.js'
import Script from './Script.js'
import BigNumber from '../primitives/BigNumber.js'
import OP from './OP.js'
import ScriptChunk from './ScriptChunk.js'
import { toHex } from '../primitives/utils.js'
import * as Hash from '../primitives/Hash.js'
import TransactionSignature from '../primitives/TransactionSignature.js'
import PublicKey from '../primitives/PublicKey.js'

In React, functional state variables are used to store and manage data within a functional component. They allow you to create components that can hold and update their own internal state without needing to convert them into class components. Functional state variables are typically declared using the useState hook, which is a built-in hook provided by React.

To use functional state variables, you first import the useState hook from the 'react' package. Then, within your functional component, you call the useState hook and provide an initial value for your state variable. The useState hook returns an array with two elements: the current state value and a function to update that value.

Here's an example of using functional state variables in a React component:

import React, { useState } from 'react';

function Counter() {
const bitbusPromise = boomerang(
'POST',
'https://txo.bitbus.network/block',
query,
{ format: 'json', token }
)
const bitsocketPromise = boomerang(
'POST',
'https://txo.bitsocket.network/crawl',
query,