'Thousand separtor in React Mui TextField

I'm trying to add Thousand separator to my mui-textField value,knowing that i already made digit separation.my code looks like this:

<TextField
                    size='small'
                    label='Total Cotisations Encaissées'
                    value={
                        totalEncaissement
                         ?.toFixed(modeMO)
                        ?.replace(/\d(?=(\d{3})+\.)/g, "$& ") || 0
                    }
                    variant='outlined'
                    fullWidth
                    type={"number"}
                />
            </Grid>

The field doesn't dispay anything when i add replace, but works totally fine with toFixed only. Please could somebody help



Solution 1:[1]

According to MUI documentation you can use react-number-format package to add a thousand separators to the TextField component.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1