Skip to content
Advertisement

How to send a component as an argument to a function in another component?

In my case, I have a components ‘1,2,3,….’ imported in another main component ‘A’. In component ‘A’ some operation is done and among the components ‘1,2,3…’ one filtered component is returned.

I have to send some props to this filtered components and render this filtered component. Am posting my code please have a look. Thank you.

JavaScript

AR008Users and AR009Users are the exported components.

What I am expecting is to use the filtered component to render JSX data and want to send props to that component, like this:

JavaScript

Advertisement

Answer

In your object you should use a reference to the Components and not use jsx to instantiate them.

Then in your rendering part, you should use either find or extract the [0] item, because filter returns an array.

Finally you should capitalize the component variable.

so

JavaScript
Advertisement