Questions tagged [react-tsx]

A TypeScript XML syntax transform recommended for use with React.

TSX is an embeddable XML-like syntax. It is meant to be transformed into valid JavaScript, though the semantics of that transformation are implementation-specific. TSX rose to popularity with the React framework, but has since seen other implementations as well. TypeScript supports embedding, type checking, and compiling TSX directly to JavaScript.

563 questions
0
votes
1 answer

Updating from an input element in ReactJS

I'm attempting to create a page using React, whereby I can update a single element of the state; here is how the state is defined: interface MyState { data?: MyData; loading: boolean; } interface MyData { id: number; description:…
Paul Michaels
  • 16,185
  • 43
  • 146
  • 269
0
votes
0 answers

Material-ui-next withStyles decorator doesn't work correctly

I'm rewriting my little project to material-ui, and I'm using for this material-ui-next reactjs library; For one component withStyle decorator worked just fine, for the other it doesn't decorate component with styles and trows this error: Uncaught…
Ivan Sukhetskyi
  • 113
  • 2
  • 13
0
votes
1 answer

cannot run web pack and cannot run project

When I run the web pack command .\node_modules\.bin\webpack -w in my project, I get the following error and when I dotnet run I get the following error I have the exact same project as my teammates but it just does not want to work on my laptop.…
0
votes
1 answer

React Redux Thunk with Typescript making api request

I have been trying to make a simple URL request to a third party API. Here is the project I am working on (https://github.com/JMStudiosJoe/ReactPractice/tree/JMStudiosReact). I have been watching Dan Abramov videos, followed this example from redux…
-1
votes
0 answers

Better methods of using a json file in multiple react components after fetching it

I'm building a web app, and it will fetch JSON files which will be used in multiple react components. How is this usually done? I have thought about importing JSON objects from where they are fetched, but I think that is probably not a good idea. I…
Oatmeal
  • 19
  • 3
-1
votes
0 answers

Need help regarding error message shown based on condition

`import React, { useState, useEffect } from "react"; import { Upload, Button, message } from "antd"; import { VscInbox } from "react-icons/vsc"; import { v4 as uuid } from "uuid"; const { Dragger } = Upload; function FileUploadAction() { ; …
-1
votes
1 answer

How to remove column header of MUI v5 datagrid in react ts?

In React Typescript using MUI datagrid, need to remove column header which is no longer needed a datagrid without column header , need to remove header instead need to add this, I did this by "& .MuiDataGrid-columnHeaders, &…
-1
votes
1 answer

To download an Image from an URL using Javascript and then publish it to Supabase Storage

I am interested to download an image from an URL for instance "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQo2zi7aWGrKd8eTtROEbeG4noyYyEicLaqpMOmqXXN&s%22" and then pass it to something like a s3 bucket. Previously I have tried to fetch…
-1
votes
1 answer

'e.target.files' is possibly 'null'

In my input component I extract file content after input. Took code from here Error occurred on the line of onChange={e => handleFileChosen(e.target.files[0])}, to be more accurate, ts underlines e.target.files. Error message is 'e.target.files' is…
Lvasche
  • 91
  • 1
  • 9
-1
votes
1 answer

Call useEffect after some interval

I want to call a function only once after some interval in my app for that I have choosed the hook useEffect. Not I want to call it after some interval to make a variable account defined which comes from useEthers() Any help will be appriciated. The…
Deku
  • 9
  • 6
-1
votes
1 answer

WebApi with Axios

Goal: Use Axios with put and post method from react TS to Backend WebApi c#. Problem: The code doesn't work in relation to CORS. What part from the backend source code am I missing in order to make backend to retrieve data that is PUT or POST? Thank…
HelloWorld1
  • 13,688
  • 28
  • 82
  • 145
-1
votes
1 answer

React typescript recognizes array as object

new to react and js in general so it might be a dumb question but I can't sort it out. I have a component like so: export interface TableViewContainerProps { header: WorthSummaryContainerProps content: TableViewRowProps[] } export const…
user11910733
-1
votes
1 answer

How to cast inside .tsx file?

I wrote some code inside a .tsx file and I need to cast a variable but it doesn't work and I don't understand why. That is my code : let a : number = 2; let b : string = a as unknown as string; console.log("b type = "+typeof(b)) And that is the…
erwanlfrt
  • 111
  • 11
-1
votes
1 answer

how to read data from a json file in a react app with tsx format

I want to load data from a json file i made. i saw some tutorial on the web but they all have js and html. my app has tsx format and im so new to the react. i found this link but cant figure it…
amir
  • 31
  • 3
-1
votes
2 answers

React, TSX Parsing error: Expression expected

Below is REACT code for details page Ticket is a primary object, and what i want to do is when downloading add the ticket name as .pdf filename. So i need a solution to pass the concrete ticket name to the handleDownload function In the render…
TaaviM
  • 1
  • 3
1 2 3
37
38