Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1795

Escaping the word type

$
0
0

Hello,

I’m trying to write some bindings for ReactMapGL and they use the word type a lot in props or properties of props.

Example:

  type sourceData = {
    \"type": string, // Is this correct?
    geometry: sourceDataGeometry,
  }

  module Source = {
    @module("react-map-gl") @react.component
    external make: (
      ~id: string,
      ~\"type\": string, // Is this correct?
      ~data: sourceData,
      ~children: React.element,
    ) => React.element = "Source"
  }

And how to use this in JSX:

<ReactMapGL.Source id="tenMilesTrail" type="geojson" data={tenMilesData}>

I’m a little confused about what to do in these three cases.
Any pointer would be much appreciated.


Viewing all articles
Browse latest Browse all 1795

Trending Articles