Category "reactjs"

React Router v4 routes not working

I am relatively new to reacts and I'm trying to figure out how to get React router to work. I've got a super simple test app that looks like this: import React

Jest: "Directory in the roots[0] option was not found"

I am trying to set up monorepo to run all of its Jest tests at once. In each package, I'm using react-app-rewired to get Babel to transpile code imported from o

ESLint - Component should be written as a pure function (react prefer/stateless function)

ESLint is giving me this error on a react project. Component should be written as a pure function (react prefer/stateless function) It points to the first lin

How can I align vertically and horizontally my fields for each column?

How do I align my columns horizontally and vertically aligned in each column? Here the picture (whatI have/whatI want): export default function App() {

Error 404 when you refresh a Next.js page

I am getting this error whenever I try to refresh a routed page in my small Next.js app.

Whats the best way to update an object in an array in ReactJS?

If you have an array as part of your state, and that array contains objects, whats an easy way to update the state with a change to one of those objects? Examp

Pagination in React/Typescript

So I am trying to achieve pagination functionality. Here I have crypto API and a table where data lies, the thing I want to achieve is displaying 10 items per

React-Bootstrap not working after npm installing and importing it

I made an app using create-react-app and then I ran npm install react-bootstrap and then npm install bootstrap Then in my main src/index.js file, I imported Boo

testing fastapi response to next.js with fetch, promise stuck in pending?

my fetch is stuck in pending when I query a fastapi endpoint in local dev. followed this blog and a few others - https://damaris-goebel.medium.com/promise-pendi

TypeError: props.onSaveExpenseData is not a function

I am leaning how to send data from child to parent component in React Why I received this error: TypeError: props.onSaveExpenseData is not a function Please hel

Docker is not accepting proxy api server

i get the following error, when doing a docker-compose up. The app is running but cannot make any api post/get requests. The express server is using port 5000.

React - How to implement isLogin() function?

I am working on implementing authentication in React. I have followed the guide https://medium.com/@thanhbinh.tran93/private-route-public-route-and-restricted-r

Next.JS Image `layout='fill'` is broken

When using the Next.js image component, the docs claim that: "When fill, the image will stretch both width and height to the dimensions of the parent element, u

TypeScript seems to be seeing a variable as 'any' even though it's defined

I have the following component: import React from 'react'; import classNames from 'classnames'; import styles from './styles.module.scss'; const cx = classNam

ReactJS Reuse Modal for Add and Edit

I have a ReactJS application, I have a page that has a table there is a create button for creating a new record that opens a modal to enter the data. That works

ReactJS Reuse Modal for Add and Edit

I have a ReactJS application, I have a page that has a table there is a create button for creating a new record that opens a modal to enter the data. That works

How to add SCSS styles to a React project?

I'm just starting to learn React (have some JavaScript knowledge, as I'm learning tis as well) and building my first project. I would like to know how to add st

React - how to add fontsize into React.createElement?

Am a little of a newbie on the block and learning React - I have this segment of a function below: AlertNotifications.prototype.render = function () { retur

ReactJS how to render an HTML object span element within a string

How can I convert an HTML object containing a span element within a string into something that Reactjs can actually render as HTML? To clarify, here's what I

React.createElement: type is invalid -- expected a string

Trying to get react-router (v4.0.0) and react-hot-loader (3.0.0-beta.6) to play nicely, but getting the following error in the browser console: Warning: React.c