'how to prevent textInput re-rendering with react native?

I am developing a simple editor application with react native. I've implemented the ability to add parentheses.

However, in order to implement this feature, I needed to manage the selection as a state, so I also gave it to the textInput props. This caused re-rendering on every input, which made it impossible to use.

How can I prevent re-rendering while maintaining this functionality?

Thank you very much for your help.

https://snack.expo.dev/@msickpaler2/textinput-demo



Sources

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

Source: Stack Overflow

Solution Source