plotly / dash-component-boilerplate

Get started creating your own Dash components here.
265 stars 182 forks source link

Migrating to React functional components #151

Closed aeltanawy closed 9 months ago

aeltanawy commented 1 year ago

I'm interested in creating my own dash component using React and while generating a project using dash-component-boilerplate, the output React files are written using class components. Any plans on migrating that to functional components instead?

I've already migrated my own project files but thought to bring this topic up for discussion since the latest React docs are all written using functional components and while it is still in Beta, they do mention that these will replace the older docs.

Thanks!

alexcjohnson commented 1 year ago

Thanks @aeltanawy - it's a great idea, or maybe we keep the class-based components but add functional alongside, so it's clear you can do it either way?

aeltanawy commented 1 year ago

Thanks @alexcjohnson ! That seems like a great way to add flexibility. Would that possibly be a choice the user have to make when answering the questions about the project?

alexcjohnson commented 1 year ago

Could be a choice, but I was imagining just putting two components side-by-side. To turn the boilerplate into a real package you need to delete the example components anyway, so adding a little more that also needs deleting seems to me unlikely to bother anyone, might even be helpful because it would show clearly how to put multiple components in one package.

aeltanawy commented 1 year ago

Interesting! So have both components and import them in usage,py?

Can I work on this?

alexcjohnson commented 1 year ago

Absolutely, we’d be delighted to accept a PR adding a functional component here!

mohsenhadadi1986 commented 1 year ago

Thanks @aeltanawy - it's a great idea, or maybe we keep the class-based components but add functional alongside, so it's clear you can do it either way?

Already I create react component by functional mode. But really missed this template in boilerplate.

tinanemati commented 1 year ago

@alexcjohnson Has there been any update on adding a functional-based component in the template alongside the class components? I'm looking into sources to create react components in functional mode instead of class-based mode. Any help is appreciated :)

alexcjohnson commented 12 months ago

@tinanemati it hasn't bubbled up to the top for anyone at Plotly to add but we'd welcome a PR for this purpose!

aeltanawy commented 11 months ago

Apologies for the delay here. I have resumed working on this issue and will be posting a PR later today.

tinanemati commented 11 months ago

@aeltanawy Thank you, Abeer!

aeltanawy commented 11 months ago

Apologies for the delay, I was troubleshooting an unexplained issue that got resolved by creating a new fork.