React Native: Issue with State Update – Component Not Re-rendering

I’m currently facing an issue in my React Native project related to state updates and component re-rendering. Even though I’m updating the state, the component doesn’t re-render as expected. Here’s a simplified version of my code:

import React, { useState } from 'react';
import { View, Text, Button } from 'react-native';

export default function MyComponent() {
  const [count, setCount] = useState(0);

  const handleIncrement = () => {
    setCount(count + 1);
    console.log('Count:', count); // Logs the correct incremented value
  };

  return (
    <View>
      <Text>Count: {count}</Text>
      <Button title="Increment" onPress={handleIncrement} />
    </View>
  );
}

Although the setCount function updates the state correctly, the component doesn’t re-render immediately, and the logged count value remains the same. I’ve tried using useEffect, but it doesn’t resolve the issue.

Can someone please provide guidance on how to troubleshoot and resolve this problem with state updates not triggering an immediate re-render of the component? Any help or insights would be appreciated. Thank you!