Add custom react component as label in Dagre D3 - reactjs

I'm using dagre-d3 library for creating a flow path. I need to have custom component for every label but its not rendering react components, it however does render properly if the label is simple html. What do I need to do?
Following is a sample of what I'm trying to achieve, the first node should be the component but its rendering a simple empty box in place of that:
CodeSandbox URL

Related

React custom Button component "as" prop

I want to add a feature to my Button component wherein I want to add an as prop just like in other component libraries to render different components based on the as value.

Is it possible to call Component using button (without using useState) in react?

I am using a button to display a modal for a particular profile (different buttons for different profiles). By using a hook, the modal just renders the last profile's info. (I am mapping the profile info list)
Is there a way I can call the modal component in the mapping itself without using Hook? Or any different approach to this problem?
(P.S the code is too long, hence not pasting it in the question description)
I wired up parent and modal using another component in between, and it worked.
I created a component receiving props(containing profile info) from parent and passing it to the modal. And the modal is called from the parent via this new component.

Render a new component onClick without using conditional rendering or react-router

Here is what I am trying to achieve. I have an MUI table that contains a list of data (say student names) and it is a Functional Component. When a user clicks on any of the items in the table, it should load the details of the student clicked in a card or a box. (MUI components). The card has a back button that loads back the same table when clicked. I'm not sure how to achieve it without using react-router or without using conditional rendering.
The doubt that I have is, do we need to hide the details component in render from the main page, till it's clicked on? Like the whole tree needs to carry this component from MainPage(Hide)-> Table(hide) -> Student details(display it on click). Do I need to hide it from the main component render and only change the prop onClick in the table component? I'm not sure if we have a better approach, where I can directly call it in the table component?
You can use custom MUI Modal component to load the details to achieve your requirement without the need of react-router.
And to toggle the Modal, you can use onClick handler on MUI TableRow. TableRow doesn't have onClick prop, but the underlying component is React's tr by default, which accepts onClick.

React Hook From with Material UI Transfer List Component

I'm using the library react-hook-form with material-ui components.
I'm working on a form containing the customized component Transfer List; my goal is to access the content of the right hand side of the transfer list using the react-hook-form register or Controller constructs so when I call submit, I can get directly the left or right values as string list.
How can I achieve this ?
Thanks in advance.

Moving placeholder text in Autocomplete component in React

I'm trying to create a Material UI's Autocomplete component. Instead of showing suggestions of Autocomplete as dropdown, How can I show it as moving placeholder? The text inside the Autocomplete component should slide in left?
Code: https://codesandbox.io/s/material-demo-forked-mgg7z?file=/demo.js
The search results (The Godfather) should have a slide in left motion as a placeholder.
I created a custom hook useAnimatedPlaceholder in this demo
https://codesandbox.io/s/material-demo-forked-2em32?file=/demo.js
It can be easily inserted into any input base components. The functionality is achieved via using the useEffect and setTimeout combo. Let me know if you have any questions.
You can also give a text field inside autocomplete.

Resources