Every time you set a state the affected components will have to rerender. Every time you render your component you end up calling checkValue which sets a state and triggers another rendering.