import { memo } from "react"

export function sideEffects(fns: (() => void)[]) {
  const components = fns.map(fn =>
    memo(() => {
      fn()
      return null
    }),
  )

  return memo(() => (
    <>
      {components.map((Component, index) => (
        <Component key={index} />
      ))}
    </>
  ))
}
