#Best Practice for NodeTypes

1 messages · Page 1 of 1 (latest)

night crow
#

You can use a generic nodeType like Panel and if you want to show something different inside that Panel Node, you can pass a property in the data object of that node titled type which can be an enum with different values and based on that current enum value for the node, you can show different view for the same nodeType.

real oxide
#

My question is using union type for different nodeTypes is something ok or not
super common. the way to think about it is this:

  • nodeTypes is how react flow knows what component to render
  • a node's data is how a component knows what to render

this is becomes just a domain modelling problem, when is something a single Thing that is configurable vs when is it multiple separate Things

#

if a panel is always the same structure but the content is different then i would consider that a single Panel nodetype and use node data as a way to configure the content.