How to set an ID in react-native-web

(in hindsight obvious, while trying not so)

So a few months ago, I wanted to set an `id` on a react-native-web (RNW) View component <View id="newsletter"/> But that doesnt work.

Turns out in order to maintain compatibility with ReactNative, RNW uses `nativeID` This is in the docs, but I somehow missed it, until i found this issue

So to set an ID on a view in react native web, which will be mapped to the elements dom node do this

<View nativeID="some-id" />

docs referencing this are here



Getting Free

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store