tsx Questions
5
I'm importing the following code into my .tsx component:
import resolveConfig from 'tailwindcss/resolveConfig';
import tailwindConfig from '../../../tailwind.config.js';
const fullConfig = resolve...
Boll asked 4/2, 2022 at 9:5
12
Solved
I've used the Prettier extension in the Visual Studio code editor for a long time, but recently, I have been writing to React with Typescript. So I need to configure for Prettier to format .tsx fil...
Corvese asked 11/5, 2020 at 14:4
24
Solved
I have a React Typescript application that won't compile. Many components have a render method that is typed to return React.ReactNode or React.ReactElement. On compile, many errors similar to the ...
Trestle asked 11/4, 2022 at 16:55
3
Solved
I am unable to define a 'dark' theme with MUI for my site when declaring type: 'dark' anywhere outside of the direct createMuiTheme() funciton.
For example, the following works:
const siteTheme =...
Cater asked 5/7, 2019 at 22:56
16
I just can't wrap my head around this I guess, I've tried probably half a dozen times and always resort to any... Is there a legitimate way to start with an HTML element, wrap that in a component, ...
Verile asked 21/11, 2016 at 23:29
3
Solved
I have inherited a bit of a legacy project with JSX. I am in the process of converting the JSX into TSX.
Currently while importing JSX and JS files in TSX. I get an error Cannot find module 'config...
6
Solved
I get this error when using "Cropper" from the react-easy-crop lib, I've tried a few things that I found on forums such as adding @types/react, importing * as React from "react"...
Footsie asked 17/9, 2021 at 8:22
10
Solved
I want to define jsx like this:
<table style={{'--length': array.lenght}}>
<tbody>
<tr>{array}</tr>
</tbody>
</table>
and I use --length in CSS, I also have ...
Incorporator asked 24/8, 2018 at 13:0
2
I just started using TypeScript with Next. What does this do?
import { NextPage } from 'next';
export const Page: NextPage = () => {}
I looked at the docs but it does really give a good explanat...
Ineducable asked 9/12, 2021 at 8:43
13
Solved
I'm coding a ReactJS class with Typescript and Material-ui, in a .tsx file. In one of my custom components, I want to create a reference to one of the components that I use in my custom component.
...
Doff asked 28/5, 2020 at 7:39
6
Solved
Trying to start a gatsby+react+typescript project and VSCode will only apply syntax highlighting to the HTML in my .tsx files. The typescript code remains a single color. How do I fix this?
Note: ...
Iconostasis asked 1/10, 2019 at 3:17
5
suppose I have this monorepo:
/apps
/apps/app1
/apps/app1/src (contains index.ts and many other files and subfolders here)
/apps/app1/tsconfig.json
/apps/app1/package.json
/apps/app2
/apps/app2/sr...
Probst asked 25/9, 2023 at 18:37
2
Solved
I am using yarn v2 to install the dependency package, and using yarn start command to start the project smoothly, but vscode always reminds me that I can't find any local modules.
And here is my t...
Itching asked 7/3, 2020 at 4:7
3
Solved
Im a beginner in React Typescript, and I have defined some props is a .JS file that I want to use in a .tsx file. but I receive this error on one of my TypeScript lines:
<MyTextField style={{w...
Murdoch asked 16/4, 2020 at 7:15
5
Solved
Using @types/react 16.8.2 and TypeScript 3.3.1.
I lifted this forward refs example straight from the React documentation and added a couple type parameters:
const FancyButton = React.forwardRef&l...
Davisson asked 12/2, 2019 at 16:12
10
Solved
I am trying to use useRef with TypeScript but am having some trouble.
With my RefObject (I assume) I need to access current. (ie node.current)
I have tried the following
const node: RefObject<H...
Earlineearls asked 6/4, 2021 at 5:48
34
Solved
I have looked around a bit for a solution to this problem. All of them suggest adding "jsx": "react" to your tsconfig.json file. Which I have done. Another one was to add "include: []", which I hav...
Arlenaarlene asked 20/5, 2018 at 7:17
7
I'm trying to implement this in a React TypeScript File:
export class MainInfo extends Component<IProps>{
continue = e => {
e.preventDefault();
this.props.nextStep();
};
render() {
...
Bienne asked 17/4, 2020 at 6:57
12
Solved
I can't figure out how to set default property values for my components using Typescript.
This is the source code:
class PageState
{
}
export class PageProps
{
foo: string = "bar";
}
export cl...
Elianaelianora asked 17/5, 2016 at 16:52
2
Solved
I have this code for a component:
Feedback.tsx
import React, { useState } from 'react';
import './Feedback.css';
import FeedbackButton from './FeedbackButton';
function Feedback() {
const [isOpe...
Misname asked 7/12, 2020 at 14:45
4
My team is creating the administration panel of a CMS using React, Typescript, TSX and Webpack. Each page of the administration panel has been created as a React component, and each page contains m...
1
I have created a React app with Typescript and JSX (creating .tsx files instead of .ts) which I am attempting to run in a docker container with hot reloads but with little success.
I've tried using...
Doublebreasted asked 11/2, 2022 at 16:17
2
Solved
In one of my React components, I have the following definition for some custom elements:
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace JSX {
interface In...
Uncourtly asked 11/6, 2022 at 7:28
2
Solved
I want to comment TSX code that I showed below. How can I do that?
<Form.Group controlId="type"> <Form.Label>Type</Form.Label>
Gilliland asked 12/6, 2021 at 17:11
3
Solved
How do I iterate through a React component's children in Typescript tsx?
The following would be valid jsx:
public render() {
return (
<div>
{React.Children.map(this.props.children, x =&g...
Mom asked 1/12, 2015 at 21:16
1 Next >
© 2022 - 2024 — McMap. All rights reserved.