Category "reactjs"

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

How to change swipe direction in swiper.js?

I'm struggling with changing swipe direction when I rotate my swiper on 90deg. So in the beginning by default it has horizontal direction. When clicking on sli

Cors problem with nginx/django from react app on docker

I have a question about cors implementation in django. Having a problem with setting the correct cors values. My deployment is on docker. I have a deployed 3 co

How to convert React.FC syntax to const x = () => {}?

I have this code below that I tried to convert its syntax (I am using TypeScript, React) from the syntax below to const x = () => {} form. const EntryDetails

reactjs creating part of the table scrollable

To make part of the table scrollable I'm using a div inside of the table but getting the warning: Warning: validateDOMNesting(...): <div> cannot appe

How to solve Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app)

I am trying to create a chatroom application using react and firebase. Initially, I got an error while importing auth and firestore at once i.e import { auth, f

Listen to route change with next.js to use with matomo/piwik

I'm trying to listen to route changes on a next.js app, in order to log navigation to matomo (aka piwik). According to next.js' documentation, I have to do some

React native - disable scrolling in 1 direction

Is there a way to disable one ScrollView in react native (iOS)? I mean i need only to pull down to refresh but, I can also pull up. I want to disable the pull

ReactJS, find elements by classname in a React Component

I've a React component. Some elements will be inserted through the children. Some of these elements will have a specific classname. How can I get a list of thes

How to do nested conditional rendering in React?

A situation I have not ran into before due to way roles/authentication work in a project I am working on. On login, the code returns whether the user is just a

how to fix application error on heroku when i deploy react app along with json-server

I have been trying out json server along with react but for some reason I keep getting application error on Heroku. is it alright to use json-server for testin

How to connect MySQL database to ReactJS app?

I have build a Todo App with create-react-app. The store I'm using is based on Local Storage(JS attribute of object window). Now I created a MySQL databases and