Category "reactjs"

How to perform tree shaking for lodash in a create-react-app project?

I need to perform tree-shaking to reduce bundle sizes where lodash and some other libraries are being used. I've converted all lodash imports like this: import

Next Auth "Credentials" redirection when throwing error on custom login page

I have a custom login page, which in turn calls the signIn() function when submitting the form. I am only using the "Credentials" provider. Server-side, I am ju

Options for User Session Management with React and Flask

After days of reading through the source code of Flask and Flask-Login and trying to figure out why my user sessions aren't being visibly accessible outside the

How to use syntax code highlighting using next-mdx-remote?

I'm trying to highlight my code syntax using next-mdx-remote in my Nextjs based page. I'm getting my markdown format from graphcms and rendering it like this :

How i can limit the items in the FlatList and add load more?

My skills is basic, and i'm newbie in React native, what i want to do is limit the posts in 12 and when the user scroll automatically load more posts. My Code:

Installing create-react-app gives npm ERR! shasum check failed and npm ERR! Unexpected end of JSON input while parsing near '...mojOzGIEI2rg0m24Yb5Oq'

Errors when i use sudo npm install create-react-app -g npm ERR! Linux 4.13.0-39-generic npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i" "create-react-app" "-g"

How to find declaration for my typescript/react module?

I am very (very) new in frontend technologies, specially react and typescript. My issue come when trying to do a simple thing that is to use a react component

How to sort data in ascending or descending order in Reactjs?

I have products data which I am importing in my displaycomponent. For each product in JSON I am using .map() to display the content. Now I want to sort the prod

How to get updated state from Redux store using redux-toolkit after component has already rendered?

The functionality I am looking for is that of an e-commerce website. A click on the add-to-cart button adds product to cart. I am able to successfully achieve t

Issue with Web3.js, try to call he contract to see the state

Hi everyone! I tried to make a call to the state of a contract developed on truffle, using web3.js in React, the problem is this, when I try to see the price of

Emit data from stencil component to ReactJs component

How to catch emitted data in stencilJs component in ReactJs component? I've created a CustomInputStencil component that has a prop of onChange that accepts a fu

Edit Product with images using React-Dropzone

When creating a product I use React-Dropzone but when editing I intend to use it in the same way. I would like that when editing the product, the images that ar

How do I adjust the position where an anchor lands?

I'm using React and Material UI for this, On my navigation bar at the top of the page I have several links that are anchor links: return ( <Box sx={{

Navigation error: Null is not an object (evaluating '_navigation$getParam.id')

I don't know why my navigation isn't working properly, it throws me the following error every time I want to navigate back to my EventAssistants screen from my

How to detect the device on React SSR App with Next.js?

on a web application I want to display two different Menu, one for the Mobile, one for the Desktop browser. I use Next.js application with server-side rendering

default value for multiple select in form antd 4

I'm unable to set default value for multi select inside form. Use Case: I have created a react component that renders a select with some default props that I n

Check if the browser tab is in focus in ReactJS

I have a website in ReactJS. I want to get a callback whenever my tab comes in focus or is hidden. I came across the Page Visibility API for this but I'm not ab

How to cancel a fetch on componentWillUnmount

I think the title says it all. The yellow warning is displayed every time I unmount a component that is still fetching. Console Warning: Can't call setStat

How to restrict user below 18 years to not register using reactjs datepicker?

I have successfully implemented the react js datepicker. Now I want to restrict users below 18 years to not register. This is my datepicker <DatePicker se

How to use a getter function inside a React component?

I am trying to make a basic React component to retrieve a value from a deployed contract. In this example, I am using an input box to receive a contract address