This is the code I use. I produce alternate roots and paint in different colors. But the screen does not work.
Which part is wrong. If you set the response to direction, it draws a single path.
https://stackblitz.com/edit/react-alonzm?embed=1&file=index.js