How to assign dynamic values within codes in react

47 Views Asked by At

I am using react-vis-network to create graphs. below is the syntax to use react-vis-network.

const MyNetwork = () => (
  <Network>
    <Node id='vader' label='Darth Vader' decorator={Decorator} />
    <Node id='luke' label='Luke Skywalker' decorator={Decorator} />
    <Node id='leia' label='Leia Organa' decorator={Decorator} />
    <Edge id='1' from='vader' to='luke' />
    <Edge id='1' from='vader' to='leia' />
  </Network>
);

i would like assign dynamic values to 'id' and 'label'. I tried below also {n.name}without codes("). both the options are not working.

<Network>
{data.Application.map(n => {
  return (
       <Node id ="{n.name}" label="{n.name}" />
          );
            })}
</Network>

can someone advise me on how to pass dynamic values within codes to the variables id and label

0

There are 0 best solutions below