How to make clipping plane with react three fiber?

I want to make a clipping plane in react three fiber. I want this building to be cut a specific part from the top in condition and reset again on condition. How I can do this? I’m using react three fiber.
Screenshot (6)

I found example here but don’t know how would I do in r3f?