Questions tagged [React] (2958)

1
answer

ReactJS: How to assign a variable the result of fetch(list of objects)?

Beginner in js: Need to use variables storeProducts(array of objects) and detailProduct(specific object) later in the program, but they are not visible outside getDetails. How to solve this dilemma? Tried to assign without async functions and await keyword, but in this case, instead of an array of Promise objects return {}....
Tommie46 asked April 4th 20 at 14:22
1
answer

Where can I find information about how to efficiently store data on the client obtained (json) from the server?

With servers come in the data where arrays and objects are nested in one another, and this data on the client then it is very difficult to manipulate. How to learn how to effectively store and use the data on the client to access was simple and easy? What can be read, or that you will be able to recommend to me ?
daphne_Gutkows asked April 4th 20 at 14:22
0
answer

How to display message when error fetch?

There is a component that displays error messages export class Snackbar extends React.Component { constructor(props) { super(props); } state = { messages: [] } addAlert(message, timeout = null) { const uniqueId = Date.now(); this.setState({ messages: [{message, id: uniqueId, onClose: !timeout && this.close...
Neha_McGlynn asked April 4th 20 at 14:21
3
answers

Why not read state react?

I do not understand, why not read state When I output to the console during the Initialization state, then everything is fine and all is displayed but in the render the console is already on the "form" sees nothing import React { Component Fragment } from "react"; import Form from "./components/Form.js"; class App extend...
patrick.Bins asked April 4th 20 at 14:21
1
answer

"bad channel CORS preflight" — how to solve?

Good afternoon. In .htaccess add the following headers: <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" Header always set Access-Control-Allow-Headers "append,delete,entries,foreach,get,has,keys,set,values,Authoriz...
teagan_Koch asked April 4th 20 at 14:21
2
answers

How to add a menu on swipe?

Tell me how to add an open menu by swipe? As in the photo below Ran to the library @sandstreamdev/react-swipeable-list, but she unfortunately does not have support for TypeScript
Ismael86 asked April 4th 20 at 14:21
1
answer

How to update the gradient in d3.js when PreRender?

https://codepen.io/crystel/pen/RwNmpoO Hi all. Please tell me how to solve the following problem. I have an implementation schedule (curve) with animation. And implementation of the gradient. If you change the state (in this case, resize), the curve is redrawn normally, with the gradient same problem, its previous state rem...
crystel asked April 4th 20 at 14:20
1
answer

How to import files outside the src in create-react-app?

In General I have a project inside which are the folders app and lib. in base I have to have all the components, in short this is my library, I'll have to upload it using necessary to a project in the app. but in create-react-webpack app is set up so that I can't import outside of the folder src. I tried to write in .env ...
Imani asked April 4th 20 at 14:20
0
answer

Who knows why undefined?

Hi, fall is undefined and why I can not understand. Can someone explain? Here is the code: import React from 'react'; import the Header from './Header'; MapCont import from './MapCont'; import './style.scss'; export default function Leftside(props) { console.log(props) // here comes the object : {timestamp: 1580223258, ...
bud_Gerlach36 asked April 4th 20 at 14:12
2
answers

How to select text in input?

Clicking input have to select the text inside, do so const onFocus = (e) => e.target.select(); <input onFocus={onFocus}> But the problem is that the first focus of the text is highlighted. But if you click in any place except the input, and then back to input, then do not stand out.
Ilene asked April 4th 20 at 14:10