Question: Suppose I have a react app, and I have component A and component CountryCard, suppose that component A displays several times component CountryCard, as a deck of cards, by using a map instruction as in

```
{this.props.countries.map(country => <CountryCard country={country}...

```

How do I handle a click on one CountryCard?, is it enough that I use onClick, as

```
{this.props.countries.map(country => <CountryCard country={country} onClick={this.handleCountryClick(country)}...

```

or do I have to add an event listener, how do I do that?
Thanks in advance

Rafael

Answer: 
[`File.Create` "creates or overwrites a file in the specified path."](https://learn.microsoft.com/en-us/dotnet/api/system.io.file.create?view=net-5.0)

You probably want [`File.OpenRead`](https://learn.microsoft.com/en-us/dotnet/api/system.io.file.openread?view=net-5.0).
That's how it worked for me.

```
    static async Task Main(string[] args)
    {
        await TryUpload();
    }

    private const string Boundary = "EAD567A8E8524B2FAC2E0628ABB6DF6E";

    private static readonly HttpClient HttpClient = new()
    {
        BaseAddress = new Uri("https://localhost:5001/")
    };

    private static async Task TryUpload()
    {
        var requestContent = new MultipartFormDataContent(Boundary);
        requestContent.Headers.Remove("Content-Type");
        requestContent.Headers.TryAddWithoutValidation("Content-Type", $"multipart/form-data; boundary={Boundary}");

        var fileContent = await File.ReadAllBytesAsync(@"<path to file\Unbenannt.PNG");
        var byteArrayContent = new ByteArrayContent(fileContent);
        byteArrayContent.Headers.ContentType = MediaTypeHeaderValue.Parse("image/png");

        requestContent.Add(byteArrayContent, "avatar", "Unbenannt.PNG");

        var postResponse = await HttpClient.PostAsync("/api/Image", requestContent);
    }

```