#Any docs for the app router in Next JS?

1 messages · Page 1 of 1 (latest)

grizzled kindle
#

I'm new to react flow and wanted to set up a project inside the latest version of Next.js, but I can't find anything on how to use react-flow with the app router... The only thing I can find is this issue on the github
https://github.com/xyflow/react-flow-example-apps/issues/3

Does anyone have some more info?

GitHub

I am trying the basic example using "reactflow": "^11.8.3" and "next": "13.4.19". I am using the app router of next.js. The nodes and edges are not rendered....

maiden grail
#

What exactly isn't clear though?

#

App router and react-flow don't have anything to do with each other directly, so I don't quite see where the issue is? 😄

#

Route to a page, the page renders a component, that component could be <ReactFlow> 🤔

grizzled kindle
#

The problem has something to do with the nodes. In Next 12+ you have to specify if a component is rendered server-side or client-side and from the moment you use any useEffects etc it has to go client-side. However when I create a client-side component with the <ReactFlow> inside of it none of the nodes show...

Seems like something easily fixable, but I'm not sure where to start debugging the node rendering...

maiden grail
#

Mhh.... 🤔
Yeah SSR support hasn't landed in ReactFlow yet so SSR wouldn't really give you anything visible

#

But you say it's already marked as client-side

grizzled kindle
#

I'll make a quick code sandbox, maybe it's something else I'm missing...

frigid sapphire
#

your nextjs root layout is broken

#

you have to return <html><body> ...

grizzled kindle
#

Damn! It's fixed now! Thanks 😄

So weird, since there was a <html> and <body> in the inspector tho...