1,299 questions
1 vote
1 answer
111 views
How can I customize the default sorting behavior in a PrimeReact DataTable?
I want to enable sorting with null values in PrimeReact. Currently, null values are always placed at the bottom by default, similar to Excel's behavior. Previously, sorting was working as shown in ...
1 vote
2 answers
89 views
How can I customize the sort icon color for specific columns in a PrimeReact table with multi-sort enabled?
I am using a PrimeReact table with multi-sort functionality, and I need to change the color of the sort icons for specific columns. Specifically, I want the sort icon in the Code column to be red and ...
0 votes
1 answer
131 views
Why aren't defaultProps applied to my React functional component?
I'm working on a React project and attempting to use defaultProps with a functional component. However, when I don't explicitly pass props, the default values are not being applied. Course component: ...
0 votes
0 answers
67 views
Typescript Type Inference Using a Boolean Property and Discriminating Unions
What happens inside of a React Functional Component that affects type narrowing? type SelectField = | { multi?: false; value?: string; } | { multi: true; value?: (...
-1 votes
2 answers
96 views
How to pass a component and state value in React to render conditional data based on user selection?
I am working on a React project where I have two components, UserRules (Component A) and UserEmail (Component B). I need to pass the value of a state variable selectedVoucherOption from Component A to ...
1 vote
1 answer
90 views
Converting and using a class component with functions to a functional component in React?
For context, I'm trying to make a project using the html canvas in React. I am trying to replace the class components with functional components for uniformity and avoiding mixing of class and ...
-1 votes
1 answer
55 views
How react functional component works? [duplicate]
Can someone explain the difference in calling a JSX Element as component and as function in react? These are my functions. Case-1: as a function const MyFunction = () => { return ( <div>...
0 votes
0 answers
76 views
React State Update Not Reflecting Immediately in Conditional Rendering
I am working on a React component where I need to select an item from a list and update the state with the selected item's ID. I then want to conditionally render the selected item. However, I am ...
1 vote
1 answer
54 views
Functions not using most recent state in React functional component
I am converting a class component to a functional component but I am having an issue where state values from useState are not the most recent values inside a another function. Because the functions ...
0 votes
1 answer
39 views
UNSAFE_componentWillReceiveProps(nextProps) in functional component
I have a class based component as below: class NeedsApprovalEditTransactionInfoContainer extends React.Component { UNSAFE_componentWillReceiveProps(nextProps) { if ( nextProps....
0 votes
1 answer
29 views
labels customisation in line chart using highcharts
I am using line chart, where I have added plot bands ranges. I want to return those labels of y-axis which are present in plot bands. labels: { formatter: function () { if ([-12, -10, 0.0, 6.5, 10, 20]...
1 vote
0 answers
162 views
How to implement a linkedlist using Typescript in a functional component in React?
I'm currently learning data structures on my own. Most websites provide an implementation using classes and I'm unable to find an implementation using functions for functional components. I want to ...
2 votes
1 answer
400 views
How to transform a class component to a functional component in SPFx React.js and get value from a SharePoint list
I have a written a class component in SPFx with the pnp/js framework and React.js. I need to transform it to a functional component in react. I'm struggeling to call my SharePoint lists now. I have a ...
0 votes
1 answer
234 views
Is it possible to define a specific type for React Node children (and their props)?
If I have a functional component... const MyParent = (props:MyParentProps)=>{ etc... } ...is it possible in Typescript to define that all children must adhere to a specific type or interface? ...
1 vote
1 answer
112 views
How to redirect to specific route when first route is matched in react router-dom v6 [duplicate]
In my current application, there's a route like this: "http://localhost:3000/:productId/productInfo". The :productId part is dynamic, meaning it can be anything. Users are redirected to the ...