Fabric.js: Support for React?

Created on 22 Aug 2016  路  12Comments  路  Source: fabricjs/fabric.js

Are there any plans to support React? It seems that the architecture of Fabric goes against React model, so I'm a bit at lost on how to build a React app that relies heavily on Fabric.

Most helpful comment

Hi @Kitanotori, we use fabric with react too and everything work well 馃憤

All 12 comments

No.
There is no reason to do that.
I m building an application that is react based and makes heavy use of fabricjs, after the initial tries to create components that should manage fabricjs object and canvas, we realized that there is no reason to do that.
We have a store for fabricjs state that we update on certain events and our component read from that store. Everything is ok.

Is there any example anywhere on how to use React and Fabric.js without hassle regarding state and event management? Would you recommend to use e.g. Redux for managing Fabric.js state?

Hi @Kitanotori, we use fabric with react too and everything work well 馃憤

@DonovanCharpin can you give me sample or Demo how I use fabric.js with react ..parmar.[email protected]

I also need a sample, [email protected]

@DonovanCharpin can you provide me sample also
email: [email protected]

Can you also send me a sample?
email: [email protected]

In what kind of react support are you mostly interested?

Do you know how to add image in fabric js with react?

To add an Image in fabricjs with react you use the same old code.
You probably to run a function after the component mounted in the DidMount.

What we can offer is an "official" way to start a canvas with fabricJS in react.
But not something like <Canvas><Image /></Canvas> it does not make much sense to me.

I can adding image to canvas. When i add IText and image, every i change IText color the activeObject on Itext always gone so i have to click IText again it's very disturb. But when i didn't add the image, the activeObject is not gone, so i can change the color without click the IText again.
Do you know why? this is my code
image

you should not try to manage fabric canvas like this in react.

Managing react state and fabricJS state together is complicated. Can you describe your flow better?

Was this page helpful?
0 / 5 - 0 ratings