react-split-flap-effect icon indicating copy to clipboard operation
react-split-flap-effect copied to clipboard

How to insert a comma with render?

Open socketopp opened this issue 3 years ago • 0 comments

Hi, awesome lib!

How would I use render to insert a comma? Also, using render, removes the className from the FlapDisplay object. I guess, it each render, I need to add className again?

<FlapDisplay chars={Presets.NUM} length={7} value={currentPrice.toString().replace('.', '')} className="L"
render={(data) => {
const { children } = data;
  return (<div className="L"> {children}</div>); 
}}

I have figured out this much.

The price look like this "1.01788" I thought I would replace the dot so it looks like "101788" and then after the first element in the children list add a dot. However, I am not sure this is the "correct way" and right way to go.
I can't modify props because TypeError: "value" is read-only What do you say?

socketopp avatar Dec 20 '22 21:12 socketopp