React answers

  • 0answers
    Query component vs useQuery hook, which is better to use?
    I understand using GraphQL + React, tell me in real projects when to get data from the API using the hook import {useQuery} from '@ apollo / client'; and when is the component? import { Query } from '@apollo/client/react/components';
    React Anonymous, Aug 22, 2019

  • 0answers
    Can you create a React admin area?
    Can you create a React admin area? For a person to go there, add news and on another page it is displayed? And what else do you need to know besides the reactant?
    React Fynn Blackwell, Aug 10, 2020

  • 0answers
    Why doesn't the reducer work without specifying the type?
    I am using react-redux + typescript. Here is the simplest reducer I use: type msgObjType = { name: string email: string msg: string}type msgObjActionType = { type: string payload: msgObjType}const msgReducer = function msgReducer(state = { msgs: [] as ...
    React Lilah Crane, Oct 15, 2019

  • 0answers
    Why do nextjs in Link do a?
    Hey. The question is for those who code in Next.js. Is it necessary inside & lt; Link & gt; to do & lt; a & gt; ? & lt; Link href = {'/'} & gt; & lt; a & gt; {post.title} & lt; / a & gt; & lt; / Link & gt; In the docks it is used with & lt; a & gt; , but it is rendered fine in ...
    React Cole Charles, Sep 19, 2019

  • 0answers
    How to beat mb_YTPlayer plugin to output Youtube videos in React?
    Can't connect this plugin in React. It all doesn't work: https: //gist.github.com/juusechec/67135bae65ba1a69 ... https://codepen.io/JaSTIN/pen/wogdaL https://github.com/pupunzi/jquery.mb.YTPlayer/wiki
    React Annabelle Weiss, May 13, 2020

  • 0answers
    How do I create an indicator using React?
    I need to make such an indicator using React. How can I render, for example, 6 divs, and depending on the number, some of them are filled, some are empty ... For example, I received a number from the back 5 - 5 filled, 1 - empty
    React Anonymous, Jun 24, 2020

  • 0answers
    Why doesn't setState change state?
    Hello. Can you fix me? My setState does not change the state of (city), why? Perhaps I made a mistake due to carelessness or lack of knowledge :)))) function App(props) { let state = { city: "Piter" } const gettingWeather = async (e) => { e.preventDefault(); let city = ...
    React Anonymous, Jun 18, 2019

  • 0answers
    ReactJS using useEffect hook, how to use dependency correctly?
    Hello! Tell me what I'm doing wrong, here's a simple piece of code ... const userId = +props.match.params.userId || props.userId; useEffect(() => { props.getProfile(userId); props.getProfileStatus(userId); }, [userId]); ... What chrome dev tools swear at (not an error, ...
    React Hazel Robertson, Dec 10, 2019

  • 0answers
    How to tell Typescript to understand index.tsx by default?
    Hello everyone. Please help me figure it out, I'm trying to roll TS to a React Project and ran into a problem. Before that, webpack understood index.jsx in import paths and allowed not to add index.jsx For example I have a component components / Container / index.jsx I could write import ...
    React Parker Campbell, Feb 1, 2020

  • 0answers
    Props is not defined error?
    class Parent extends React.Component { constructor(props) { super(props); } render() { return ( <div> {props.title} </div> ); }}class Children extends React.Component { constructor(props) { ...
    React Anonymous, Jun 11, 2019

  • 0answers
    Error Error: Actions must be plain objects. Use custom middleware for async actions?
    action: export const signIn = valid => { return { type: 'SIGN_IN', payload: valid }} reducer: const loggedReducer = (state=false, action) => { switch(action.type) { case 'SIGN_IN': return !state; default: return state; ...
    React Anonymous, Aug 17, 2019

  • 0answers
    Where to connect mixins and other scss files during development so that they are available in all components?
    I have my own scss file for each component. The components themselves are connected in the App.js file. Is it possible to connect the app.scss file somewhere, which contains general settings and mixins, so that I can use them in all scss files without including app.scss in each of them?
    React Anonymous, Jul 15, 2019

  • 0answers
    Better store or state?
    Let's say I have 2 files main.js and table.js, what is the best way to transfer table data to table.js? use redux actions to network and edit the table, or, through props, put the set functions and the table data themselves there
    React Anonymous, May 24, 2019

  • 0answers
    Next.js how to make the server right ??
    In general I roughly understand how Next.js works and everything is fine. We need to make an online store. It was decided to write on it. I figured out the front and everything seems to be clear. But as the matter concerned the server, I realized that I did not understand: D The server is written ...
    React Emma Dyer, Jun 23, 2019

  • 0answers
    Correct use of JS function?
    Good day. I have an example two example functions in a JSX block: First: <div onClick={() => this.onClick(35)}></div> And the second: <div onClick={this.onClick.bind(this, 35)}></div> The context for both of these examples will be bound to the parent ...
    React Anonymous, Apr 17, 2020

  • 0answers
    Why is the reducer not working correctly?
    There is an array of objects, which is expanded through map in another component. A function is needed that, upon pressing the button, adds a new object to the array, thereby creating a new text field. The error is that 2 objects are added at a time. I can't understand why this works clumsily, ...
    React Xander Irwin, May 28, 2020

  • 0answers
    Error with npm install command in React on VPS / VDS host, what should I do?
    The problem is this. I clone my project on a VPS server (ubuntu) in the directory. Next, going to the directory with my project, I click npm install. The package starts downloading, and then during the download Killed[....] /@babel/code-frame: timing reify:loadBundles Completed in 0ms] ...
    React Sofia Morgan, Aug 11, 2020

  • 0answers
    How to add for resources that are required to render the first screen i.e. for css, js, fonts?
    Hello everyone. How to add & lt; link rel = preload & gt; for resources that are required to render the first screen. those. for css, js, fonts - within the CRA?
    React Anonymous, Oct 20, 2019

  • 0answers
    How do I properly load dynamic images into a child component?
    I have already addressed a similar question before, but did not find a universal answer. The site is static - built to train with the basics of React. The crux of the matter There is a main component Features in it state with a data array blocks for a child component How to properly pass the ...
    React Hazel Reynolds, Nov 12, 2019

  • 0answers
    Why is the value in props undefined after mapStateToProps?
    There is a Settings component class Settings extends React.Component { constructor(props) { super(props); } handleClick() { this.props.changeTextAction(); } render() { return ( <div className="components-page"> <Button color="primary" ...
    React Marilyn Todd, Dec 4, 2019