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

Edit mode doesn't show class attributes in React

I did both mode the creation and edit in one form but the problem when I try to edit an element I get the right id value but couldn't retrieve the attributes values. import { yupResolver } from "@hookform/resolvers/yup"; import { useState, useEffect…
user15133387
0
votes
1 answer

React Typescript: api data to array map

I have this array data from api and I want to make it in react tsx file using map function { "data":{ "cart":{ "1":{ "product_id":1, "name":"Product 1", "quantity":1, "price":"1.00" …
0
votes
0 answers

Property 'something' does not exist on 'never'

Being a beginner to typescript, I'm wrapping my head around the type notations. I can across lot of solutions, in github to define it as useState , but in my case it isn't array of objects. code: export default async function xhttp( input:…
Sai Krishnadas
  • 2,863
  • 9
  • 36
  • 69
0
votes
1 answer

React admin DateInput

Hi I'm trying to filter some data in react admin using the date input filter that is set to MM/DD/YYYY however the server that I am fetching from has the date listed as "date": "2021-11-27T00:00:00Z". I was wondering if there is a way to filter by…
niconi
  • 41
  • 1
  • 8
0
votes
0 answers

How can i close tag ?

code I followed the guide from this site, but at step 6 there was an error that I cannot fix. I've already tried inserting at the end but only more errors appear.
0
votes
1 answer

Material Ui DataGrid IsRowSelectable not working in React ts

I'm working with react TSX, I have a Datagrid on which checkbox selection is enabled. I want to disable selection for certain rows. I came to know that isRowSelectable prop is used in the material UI data grid for that purpose. Reference…
Maryam
  • 357
  • 1
  • 5
  • 16
0
votes
0 answers

Calling a function of a child from another child with same parent React

I have a parent component App that renders ChildA and ChildB function App() { const [obj, setObj] = useState(null); //state to decide if display component should be rendered in the DOM or not const [renderChildB,…
Jorge Guerreiro
  • 682
  • 6
  • 22
0
votes
1 answer

Does this "custom react hook" breaks the hooks law?

I am using many useCallbacks in useEffects in the same format syntax and feel like shortening them. So, I map them in this hook. effects is an array of useCallback functions. import React from 'react'; const useEffects = (effects: Function[])…
0
votes
0 answers

typescript - react No overload matches this call

I am trying to implement Choropleth(world map) using the Nivo library'. I use Typescript-React and when I added the legends I am getting an error. I am not good at Typescript probably, it is easy one but I could not handle the problem If I change…
0
votes
1 answer

Argument of type 'T' is not assignable to parameter of type 'string'

I'm refactoring a JS code into TS (actually jsx/tsx) and I'm facing a problem with functions. To simplify the issue... let's suppose I get this function "checkIt", which can receive a string or number as parameter and returns a boolean. This is the…
Анна
  • 1,248
  • 15
  • 26
0
votes
2 answers

Cant use react hooks with typescript

Im using typescript to compile source tsx files to js. The source code in the tsx file uses react hooks correctly, the compiled version appears to use them correctly too. Source code (tsx) import React, { useEffect } from "react"; export function…
Josh Merlino
  • 622
  • 6
  • 10
0
votes
1 answer

How to place an image folder in a react app for production/development

I am working on a personal project and there are two things that keep bugging me. This project is written in React and I am using an express node app for backend. In my frontend, I can load and send images to the server and I am saving the files…
Andy95
  • 210
  • 1
  • 10
0
votes
0 answers

How to check on first render if the state is true?

I'm trying to use the react useEffect hooks to check if the cookies is accepted on the first render. But when I test it by logging out and logging in again or closing and reopening the browser, it doesn't behave the way it should. By behavior I mean…
Waiz
  • 503
  • 2
  • 6
  • 15
0
votes
1 answer

Or logic with List filters

Ive tried both } bulkActionButtons={} perPage={preferences.rowsPerPage} pagination={} > …
snacpacc
  • 13
  • 3
0
votes
0 answers

How i can pass in Typescript React Functional Component an object of arrays as props

I create table component that i want to make reusable in other components. For example in one component i will have the latest jobs table, but in other component i will have list of customers table. So i want to add for example in props property…
aleks
  • 41
  • 6