How to change text geometry on each key type

Hello I have a case where I need to achieve the same result as in the picture
do I need to remove mesh on every input change and create a new mesh and add on seen
let’s say for removing the letter in the text

mesh.geometry.dispose()
mesh.material.dispose()
scene.remove(mesh) 

and add new letter in the text
and create a new one

mesh(geometry, material)
scene.add(mesh)

also, one question more about if I change parameters for text geometry do I need to do an update, after I change some parameters in options

You have to create a new geometry object. Geometry parameters are one-time parameters and only affect the initial generation process.

Yes. As demonstrated in your code, you should not just remove the text from the scene but dispose the geometry. If you reuse the material, it’s not necessary to call dispose() on it.

Thank you a lot @Mugen87;