Skip to content

Tag: reactjs

How to remove repeated code for ternary operator?

I’m receiving the data where a lot of fields are null, and I have to populate something if the field is null. like in the below data As here, the transit_depart is null, I’m using the ternary operator to put something in return if the data is null like this ; This is working as expected but the pr…

React make items swap in 2 list

I’m trying to make item swap in 2 array. There are 2 lists in the ui and the user select the items in the first list, then it should get removed from the 1st list and moved to 2nd list, where there are shown the selected items. The problem I got is that when I try to move the elements

React hook form how to check if mails are equal

I wonder how to check if 2 inputs are equal? I mean I want to do form validation in which I will check if first input is the same as second one. Anyone knows how to do it? If something is unclear feel free to ask 🙂 Answer Its quite simple. you get the values on onSubmit = (data) so