Relative Content

Tag Archive for reactjs

Trying to get the width/height of the element in react

I was trying to get the width/height of the div in react but when I print the value it says undefined at first in console but if I make some changes in the code (not changing the whole code but instead doing something like removing a semi colon or adding semi colon) and then press ctrl + s in vs code then the value gets printed in console, i tried adding a set time function to delay the function call but still first i get undefined

Refresh page its not working and renders my component with user: null

import { createContext, useEffect, useState } from ‘react’; import * as coreApi from ‘@services/ohtCore/Endpoint.ts’; import { Permissions, User } from ‘@services/ohtCore/types.ts’; import { clearAuthTokens, getAuthTokens, setAuthTokensInCookies, } from ‘@services/auth/tokenStorage.ts’; import logger from ‘@utils/logger.ts’; import LoadingSpinner from ‘@components/LoadingSpinner’; interface AuthContextProps { user: User | null; accessToken: string | null; login: (username: string, password: string) => any; […]

Does not want to go to the book page (using API)

The problem is this: I’m learning how to make a site on React+Django. And everything was fine until there was a need for a file that would take the book values ​​​​on the page via API.

Checkbox map checked from 2 arrays

I have an array that creates checkboxes, which works, but I also have another array which is constructed from a user array including the rights a user has. Now based on that second array, I want to have a checkbox shown checked if the user has that specific right.