I have a variable that I want to keep track of and update its value between two classes. In one of my classes, I started using props like this with the variable isLoading in my Post class:

```

class Post extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            isLoading: false
        };
    }
    post = () => {
        this.props.uploadPost()
        this.props.updatePhoto()
        this.props.updateDescription('')
        this.props.navigation.navigate('Home')
    }
    openLibrary = async () => {
        const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL)
        if (status === 'granted') {
            const image = await ImagePicker.launchImageLibraryAsync()
            if(!image.cancelled ){
                this.setState({ isLoading: true });

                const resize = await ImageManipulator.manipulateAsync(image.uri, [], { format: 'jpeg', compress: 0.1 })
                const url = await this.props.uploadPhoto(resize.uri) 
                this.props.updatePhoto(url)
                this.setState({ isLoading: false });
            }
        }
    }
...

```

Now, I also have another class called Camera that I want to update this same variable. However, I'm not implementing a child like function where I call Post or Camera class in each other.
This is my code for Camera.

```

class CameraUpload extends React.Component {    
    state = {
        type: Camera.Constants.Type.back,
    };

    snapPhoto = async () => {
        const { status } = await Camera.requestPermissionsAsync();
        if (status === 'granted') {
            const image = await this.camera.takePictureAsync()
            global.config.loading = true;
            image ? this.props.navigation.navigate('Post') : null
            if( !image.cancelled ){
                const resize = await ImageManipulator.manipulateAsync(image.uri, [], { format: 'jpeg', compress: 0.1 })
                const url = await this.props.uploadPhoto(resize.uri)
                this.props.updatePhoto(url)
                loading = false;
                // url ? this.props.navigation.navigate('Post') : null 
            }
        }
    }

```

I tried using a global config variable but the variable's value was not getting updated between classes. Please let me know what the best way to go about solving this problem is. Thanks!