Three.js (and by extension R3F) has support for collections of Line Segments (https://github.com/pmndrs/drei#segments). It would be good to explore using these for the grid as I imagine they're likely faster as it gathers lines under a single geometry (which also likely means their draw calls are batched).