Most voted "jsx" questions
JSX is a syntax extension for Javascript used in React.js, Vue.js, and other Javascript frameworks that allow use of XML along with JS code to describe HTML elements
Learn more…35 questions
Sort by count of
-
10
votes2
answers12658
viewsHow to comment code block in JSX (React)
I want to know if it is possible to comment on a code block inside the render() method in React, I tried every way I know and none of them worked. render() { return ( <div className="Events">…
-
5
votes1
answer192
viewsBug when reordering React component list
I have a component that loads a list of components <ComponenteReordenavel> which is reordered according to the user’s taste. The bug happens when I modify the style of that component and…
-
3
votes1
answer885
viewsHow to change the state of complex objects in React?
have the following object: obj = { title: "obj1", tab: [{ title: "titulo da tab 1", card: [{ title: "card1", url: "url", image: "image" }, { title: "card2", url: "url", image: "image" }] }, { title:…
-
3
votes1
answer370
viewsHow to validate an array if it has objects inside it or not? React JS
I have a code made using React JS and it works like this, I have a select component, and this is reused several times and the information it receives always comes from an array, only now I need to…
-
2
votes1
answer97
viewsLoad the state value into the currency formatted DidMount component
I want to load a value defined in state of the application. Using a lib to format the input and put Real format coin mask (react-intl-currency-input). Only it does not load the value in the input…
-
2
votes1
answer372
viewsSeparate JSX from component - React Native
Is there any way in React Native to put the whole JSX in a separate file without risk of decreasing the performance of App? Type the Angular that has a file for the HTML, other to the CSS and…
-
2
votes0
answers103
viewsAdd Object Array Subdocument Reactjs and Mongodb
Sirs, Kindly help me with this doubt? Summary: I’m creating a mini app using Node/Mongo/React. This app uses relationship in Mongo and would like help to add data via frontend(reactjs) to the array…
-
2
votes1
answer287
viewsAccess a list within a list in React jsx
Hello, I’m a newcomer to React and am making a request via Xios. This request returns me the following JSON: after receiving this list I make a .map on the list and it returns me the following: What…
-
2
votes1
answer2567
viewsHow to pass Information from a functional child component to a parent React?
I’m developing an application with React with Hooks and functional components, and I came across the following logic: I need to screen render the functional components, both with Forms arrays inside…
-
1
votes1
answer206
viewsReplay audio every time a button is clicked - Javascript and HTML
I want the audio to repeat from the beginning every time the button is pressed. Instead it only repeats after the audio has finished. (NOTE: I am using JSX) Javascript playShot() { var audio =…
-
1
votes1
answer29
viewsHow to set a state that is in a constant with React with a function
I have the following code snippet: const [aulas, setAulas] = React.useState([{ id:1, title: 'Aula 1', descricao: 'Matemática', }, { id:2, title: 'Aula 2', descricao: 'Portugues', }]) function…
-
1
votes1
answer110
viewsSyntax Error. Unexpected token '=' in React
When I try to run dev-server it returns an error in the console that I cannot identify what is generating it webpack.config.js iconst path = require('path'); module.exports = { entry:…
-
1
votes2
answers1064
viewsSpacing in the JSX
I have a JSX file and I need a space between the {item.payment.bucket} and OU. In HTML it would look something like this: {item.payment.bucket} OU. My JSX code: <ValueDiv> <Icon…
-
1
votes1
answer60
viewsAdjacent JSX React syntax error
I created a component that there are six images but when compiling my code returns me the following error. And this is my source code for the Imovelphotos component import React from 'react';…
-
1
votes1
answer396
viewsReact does not render the result of this code
I am studying React and I have a problem, more precisely in the state part, where my code does not render on the screen. In this case I have a h1 and a ul and none of them appear on the screen, but…
-
1
votes1
answer201
viewsWhy doesn’t React accept camelCase to name components?
I was preparing a component whose only function was to export a tag <p> containing a text. I naturally created a function that exported the text: import React from 'react'; function…
-
0
votes1
answer154
viewsHTML snippets for JSX
Does anyone know where I can get HTML Snippets to use in Javascript? Example: input: h1 + tab output: <h1></h1>
-
0
votes1
answer5078
viewsPass information between components without Reactjs hierarchy
How to pass information between components in React as props or status. In this situation I have a button and a menu. The menu should open every time the button is clicked. Knob import React, {…
-
0
votes5
answers388
viewsHow to exclude only a certain data from a React state
Today I have the following constant: const alunos = [{ id: 1, nome: 'Julia', curso: 'Enfermagem', }, { id: 2, nome: 'Isabela', curso: 'Veterinária' }] but I would need to just erase the id data,…
-
0
votes1
answer33
viewsIs it possible to send JSX tags from Nodejs(backend) to Reactjs?
I need to send a data to the frontend, but I need it to be already with determinate tag around it, for example... given backend: Name: Gabriel I need you to get to the front this way:…
-
0
votes1
answer25
viewsJSX elements included in closing tag
When creating the div with the SERVICES name displays the following error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? <div…
-
0
votes0
answers550
viewsRun a function and if it takes longer than x seconds of error - React Native
Good afternoon! I made a function that searches the data of a JSON on the Web, but I wanted to involve it in a function that took longer that for example 10 seconds exploded an error on the screen,…
-
0
votes1
answer1853
viewsConsume data and make Dynamic Form with React
I need to consume the data of a webservice to create a form interface for dynamic filling, that is, it must adapt the form structure received by the webservice and not be fixed with the questions of…
-
0
votes1
answer1023
viewsReact Hooks + Socket.io
I’m using the React Hooks for a simple application, a clone of the Instragam feed. To request each post in the api, I’m using this logic: function Feed() { const [posts, setPost] = useState([]);…
-
0
votes0
answers281
viewsHelp with dynamic images in Reactjs
> My code is returning the string value in the console, but does not return the image even though the path is right in the scr. I do not know what my mistake.I ask for help I am new in language.…
-
0
votes1
answer137
viewsDynamically change field in Reactjs
I am developing a project, and when typing a value in a field I need the other field to be changed based on the values I set in a function, here is the code: constructor(props) { super(props);…
-
0
votes1
answer58
viewsError while trying to render ternary conditional operator component in REACT
This is my component {portaisAtuais .filter(portal => !portais.includes(portal.id)) .map((portal, index) => { const { nome, id } = portal portaisAtuais.length === index + 1 ? ( <div…
-
0
votes1
answer176
viewsTraverse a . map() in inside . map() React jsx
I’m using React with Typescript. Is it possible to go array inside an array? This is my array: const menu: Array<{name: string; to: string; icon?: ReactNode; submenu?: any}> = [ { name:…
-
0
votes2
answers56
viewsHow to pass a specific object as props in a generation of components?
Hello, I’m initiating the studies in React and when trying to create a code that generates components (in this case the "Box")where at the click of a button passing objects coming from a state to a…
-
0
votes0
answers49
viewsModify SVG with Styled-Components (React/next)
The problem is specific and found nowhere. Summary: How I could modify the properties of my standard JSX SVG icon directly in Styled-Components as well as other icons? Details: I know with…
-
-1
votes1
answer102
viewsHow to create a container component from other components
Good afternoon! I’m trying to create a component that contains Ivs that stylize the components inside. Only there are 3 Ivs and I don’t want to replicate them every time I go to use, so I thought of…
-
-1
votes2
answers271
viewsgetElementById in React/JSX
I started my React studies yesterday so I don’t have much knowledge about, and I’d like to know how to give a document.getElementById() in React/JSX, how do I do this? I tried to use…
-
-1
votes1
answer95
viewsDisplay inputText according to the quantity selected in the React-Native Picker
I have the following problem. I have a Piker jam with quantity and I want from the quantity selection I get the same Textinput number defined by the quantity selection. Component Quantity: import…
-
-2
votes1
answer78
viewsError accessing property with map function
When I try to access the property this.props.arrayMenu shows me the following error: Uncaught Typeerror: Cannot read Property 'id' of Undefined. as shown below: import React , { Component } from…
-
-3
votes1
answer240
viewsUse component when clicking on jsx button
I’m trying to render the component Feed within that Main in jsx, but I’m not getting it. Follows the code: function Feed(props){ return( <main className='post'> <p…