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

React - convert string to use imported component

I would like to know how I could use a string key to call an svg element imported from the /assets/ folder. Here are my imports of svg images : import image1 from "assets/images/image1.svg"; import image2 from "assets/images/image2.svg"; And here…
iSckraa
  • 99
  • 1
  • 9
0
votes
1 answer

TypeError: Cannot destructure property 'toDos' of 'Object(...)(...)' as it is undefined

I'm a beginner learning ts for the first time. Thank you in advance for sharing your knowledge. I am making a to-do list. I used to react to complete it. But now I am using react and typescript together to complete the code. It seems to me that…
eeez kim
  • 175
  • 1
  • 3
  • 15
0
votes
1 answer

Property 'toDos' does not exist on type TS2339

I'm a beginner learning ts for the first time. Thank you in advance for sharing your knowledge. I am making a todolist. I used react to complete it. But now I am using react and typescript together to complete the code. It seems to me that 'reducer'…
eeez kim
  • 175
  • 1
  • 3
  • 15
0
votes
1 answer

How to stop onClick invocation, on Enter click event

I have a div that has subscription for both onClick and onKeyPress (Enter click). the desired behaviour for mouse click is: first click - open popup, second click - close popup. the desired behaviour for enter click is: open popup. when tabbing the…
Itay Tur
  • 683
  • 1
  • 15
  • 40
0
votes
0 answers

How do I create a hoc for lazy load in React + Typescript

This is my first time writing React with Typescript. When I call app.tsx, an error pop up, what's wrong with this program Error Objects are not valid as a React child (found: [object Module]). If you meant to render a collection of children, use an…
n wan
  • 1
0
votes
1 answer

Importing Components with React/TypeScript

I want to import Test component into Home but I keep getting the following error: Module '"/.../src/components/Test"' has no default export. Did you mean to use 'import { Test } from "/.../src/components/Test"' instead? In the test component I keep…
helpmepie
  • 244
  • 1
  • 6
  • 19
0
votes
2 answers

Sharepoint online Document Library Built in Web Part

I want to connect to the document library built in web part in SharePoint online and programmatically change the document library name from another web part. is There anyway to do that? web part
0
votes
1 answer

VideoPlayer using React and Typescript

Being new to typescript , I have been struggling with its implementation lately. With the help of the posts here , was able to get to the point where the video plays without any issues. Below is the code that was developed so far. export default…
Vivek
  • 61
  • 4
  • 16
0
votes
1 answer

Const component cannot read property of undefined even though it is a prop?

I have a parent? class that hosts a random question and different types of user input that depend on the type of question. 3 clickable buttons that change color on click an input box class Parent extends Component { state = { buttonColors:…
Jeffrey
  • 63
  • 9
0
votes
1 answer

Generics in functions within an object

I define the following interface interface Axis { renderTick?: (data: T) => React.ReactNode } And now I want to make an object that uses that interface. interface CustomData { name: string } const renderTick: (data: CustomData) =>…
Cragser
  • 166
  • 4
0
votes
2 answers

React Native ScrollView Wrapping for Complex Elements

I've got a ScrollView and I'm listing a few Components in it. So far, I'd been putting just one big Text component in the ScrollView and it was wrapping fine. But now that I've created a new Component (in this case, ComplexText), the wrapping is a…
Austin Brown
  • 830
  • 12
  • 24
0
votes
1 answer

noob - react typescript todo

could you please help me with a simple issue? I've always been programming in React, but I was always using pure js. Recently tried to transition to TS and I hate every single bit of it, but trying to understand all this hype. Could you please just…
MrVoland
  • 233
  • 1
  • 4
  • 19
0
votes
2 answers

Trying to redirect in react using react router

so I have a bug that I can't seem to solve. Currently I am using react with react router, however I cannot seem to get react to redirect to a page. Here is a expert from my code (keep in mind this is a functional component)
Akshat Adsule
  • 63
  • 1
  • 10
0
votes
1 answer

Errors with simple declaration file in TS for JQuery Plugin

I'm trying to copy what was done in this link here while making a slight modification. Instead of using daterangepicker, I'm using react-list-nav. However, I still am unable to get my project to "notice" any of the listnav functions, such as…
0
votes
1 answer

Switch Page without content from root page React

I wanna switch from root ("/") to /login but I wanna that the content from root Page not in /register is there. I wanna an new Page without content from the root page!! I tried everthing, rlly!! I have no clue anymore ;( Maybe u are better than me…
user14109532