mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
10 lines
284 B
TypeScript
10 lines
284 B
TypeScript
|
|
import React, { useEffect, useState } from 'react';
|
||
|
|
|
||
|
|
export const Fetch: React.FC<{ url: string }> = ({ url }) => {
|
||
|
|
const [data, setData] = useState('no response yet');
|
||
|
|
useEffect(() => {
|
||
|
|
fetch(url).then(res => res.text()).then(setData);
|
||
|
|
}, [url]);
|
||
|
|
return <p>{data}</p>;
|
||
|
|
}
|