I'm porting a small script over to React. It's a simple country-region-selector plugin that ties together a country dropdown and a region dropdown, so the latter always shows the relevant regions for the selected country. See: https://github.com/benkeen/country-region-selector
Thing is, I can't quite fathom the best way to componentize this using React. I need the two key elements (the country dropdown and the region dropdown) to be completely independent, so a user can choose exactly where the two dropdowns appear in the DOM + the surrounding markup. But I want all the inner-workings (i.e. how the two components are tied together) to be hidden from view. I was thinking maybe something like this...
<CountryRegions>
<span>arbitrary markup here</span>
<CountryDropdown />
<p>
<RegionDropdown />
</p>
</CountryRegions>
... but I'm hazy on how the actual implementation of that would work. Any ideas / better suggestions? Hope this question is clear.
ReactDOM.render()calls), or the whole app is React and you want the components to exist anywhere in the app?