Pass state from a JSX NavBar to a JSX Map in react

So I can't figure out how to use React to pass the state of my navBar to my map. I get the date from my nav bar and I need to use it in my map to display stuff only if the date matches.

class NavSearchBar extends Component {

        this.state = {
            startDate: moment().startOf('month'),
            endDate: moment().startOf('month'), 
    }//these get updated somewhere else in the code


class MyMap extends Component {
   OnEachCountry = (country, layer) => { // loops thru every country
        const country_name =; // name of country = 0; // reported incidents
        for(var tweet2 = 0; tweet2<tweet_loc.length;tweet2++){ // loops thru tweet list
            var Location_Name = JSON.stringify(tweet_loc[tweet2].user.location);
            if(Location_Name.includes( || 
              // in this for loop I want to check if its between the dates too so like 

So I'm pretty new to React, Javascript, css, jsonfiles, just starting with this project. So where the loop is I want to grab something like Navbar.state.startDate, so I can compare it against the dates in my map file.

Read more here:

Content Attribution

This content was originally published by Gex at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: