React Null Renderer

Description:

A custom React renderer that only renders null literally.

Install & Import:

import { render } from “react-nil”

Basic usage:

function Foo() {
  const [active, set] = useState(false)
  useEffect(() => void setInterval(() => set((a) => !a), 1000), [])
  console.log(active)
  // This is a logical component without a view, it renders nothing,
  // but it has a real lifecycle and is managed by React regardless.
  return null
}
render(<Foo />)

Preview:

React Null Renderer

Add Comment