Skip to main content

hooks

Hooks

useRben

Usage

const [state, set] = useRben(props)
const { entires, size } = state
const handleChange = () => set(key, ['puts "hello"'])
  • props is an objects containing Ruby code

useRuby

Usage

const [state, set] = useRuby(callback, input, timeStamp)
const { output, running } = state
const handleChange = (e) => set(e.target.value)
  • callback is a function after running the code
  • input is a text of default Ruby code to run
  • timeStamp is a number to delay running the code.

State interface

keydescriptions
error: null | Errorerror message
input: stringruby code
output: stringoutput message
running: booleantrue when running code
prevTime?: number
timeStamp: number
deltaTime?: number

useDelay

Usage

const delay = useDelay(callback, timeStamp)
const handleChange = () => delay()
  • callback is a function to run after a delay.
  • timeStamp is a number to delay time.