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

How to remove item from array stored in localstorage if the item already exists and changing state of button

In a weather app, I have tried to create an add to favorites function. So far, it works partially, but with some bugs that I can't seem to solve because I don't really understand what is even causing them. Component: import React, { ReactNode,…
jrwebbie
  • 99
  • 1
  • 11
0
votes
1 answer

React Ts, Access Parents state from Child

So I've been trying to access a parents state from a child component, however I keep getting either an error message or it doesn't work all together. I have found multiple solutions online, however none of them work for React with Typescript. So…
0
votes
1 answer

How Can I Force All Upper Case Letters with TextField? Office UI Fabric

In the following code, I am trying to get the TextField labeled "Description" to force the text to be all upper case letter. I added the handleChange code, but everytime I try to type in the field, it will freeze my form. How can I get this…
Ethan
  • 808
  • 3
  • 21
0
votes
1 answer

Error: Argument of type '{ field1: Date; field2: Date; }' is not assignable to parameter of type 'IMyInterfaceState

My interfaces (.tsx) are given below: export interface IMyInterfaceProps{ } export interface IMyInterfaceState{ fields: { ID:string, Name:string, field1: Date, field2: Date, date: Date }, errors:…
user1547554
  • 441
  • 2
  • 8
  • 16
0
votes
1 answer

ReactTS, POST request to API fails with 415 unsupported media type

I want to send data from ReactTS to API. When trying with Postman, data gets posted without a problem. API: [HttpPost] public async Task> PostTicket([FromBody]Ticket ticket) { …
TaaviM
  • 1
  • 3
0
votes
1 answer

How to create HTML elements from an object in typescript using react

I have a type that I have defined in its own .ts file export class FakeType { value:{ name: string, id: number }, x: number } and I have an instance of that object in a .tsx file let myObj: FakeType; myObj = { …
Mani
  • 27
  • 5
0
votes
1 answer

Get value of input controls which were created dynamically

In my React TypeScript project, I am dynamically creating multiple input controls like TextField, DatePicker, Checkbox, ComboBox etc... in a form like UI. On click on Submit, I want to get the value of each of the input controls. What's an effective…
0
votes
0 answers

Third party type messing with my proptypes?

I'm working with the formik library currenty and have props for my React.FC defined as the following: import { useField, FieldAttributes } from "formik"; const propTypes = { label: PropTypes.string }; type TextFieldProps = InferProps
MMStarr
  • 151
  • 1
  • 5
0
votes
2 answers

React not detecting an update in the Redux store

Hello I have a react redux store where I store the info about the currently logged in user. Here is my reducer and my actions: interface Account { username: string | null; isLoggedIn: boolean; role: string | null; } const accountReducer…
randomboiguyhere
  • 525
  • 5
  • 17
0
votes
1 answer

How can I set a different backgroundImage in

I want to give each CategoryCard div a different background-image. How can I solve this problems with styled components? I use React and Typescript. {this.MainChannels.map(item => { return (
user11425419
0
votes
1 answer

How change react port to API port?

I have designed a login page to react. It is run on 3000 ports. After clicking the login button, it should go to the API port and check the userid and password have to account or not. Screen shot This is api…
0
votes
5 answers

Print MaterialUI Dialog fullscreen

I am new to React and Material-UI and I want to print my current dialog. The problem is that I cannot find a way to maximize my Dialog for priting (set to fullScreen) without doing it in the Browser, too. So I basically want a smaller Dialog in my…
Bugsy
  • 43
  • 1
  • 8
0
votes
1 answer

Sharepoint Online + React TS. Property 'XXX' doesn not exist on type 'XXX'

So I'm currently working on this project, the project consists of Sharepoint Online and React TS. I'm currently building a dropdown menu, and have created the props and methods for the dropdown, however, I keep getting an errors: Property…
0
votes
1 answer

Material UI makeStyles inside a TSX Class Component

How can I make use of the Material UI styling options inside of a TSX class-component? Due to the Typed Props and State I can't seem to figure out how to do it. My Code below throws an "Invalid hook" error in side the componentWillMount method,…
mait.taim
  • 134
  • 1
  • 12
0
votes
0 answers

Can't get SSR of dynamic page with dynamic id to work

I am trying to SSR a dnamiy page and it doesn't work. The props as well as the query parameter in the getInitialProps method are always empty, and I can't grasp how that's possible. The code below, belongs to the file located in…
mait.taim
  • 134
  • 1
  • 12