Skip to content

Instantly share code, notes, and snippets.

@SebinLee
Created May 28, 2020 07:55
Show Gist options
  • Save SebinLee/c8152e1e7cf34f1ae5f7ed225016b6d9 to your computer and use it in GitHub Desktop.
Save SebinLee/c8152e1e7cf34f1ae5f7ed225016b6d9 to your computer and use it in GitHub Desktop.
React Testing Recipe 번역 - Mocking Modules
import React from "react";
import Map from "./map";
function Contact(props) {
return (
<div>
<address>
Contact {props.name} via{" "}
<a data-testid="email" href={"mailto:" + props.email}>
email
</a>
or on their <a data-testid="site" href={props.site}>
website
</a>.
</address>
<Map center={props.center} />
</div>
);
}
import React from "react";
import { LoadScript, GoogleMap } from "react-google-maps";
export default function Map(props) {
return (
<LoadScript id="script-loader" googleMapsApiKey="YOUR_API_KEY">
<GoogleMap id="example-map" center={props.center} />
</LoadScript>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment