Notes on React useRef and Destructuring variables

  • You can alias destructured variables
const obj = { x: 1 };

const { x: anotherNameForX } = obj;
  • You can use useRef to access previous state values.
const FunctionalComponent ()=>{
const [items, setItems]
const [values, setValues]

const prevState = useRef()

/*
	prevState = {
		items: previousItems
		values: previousValues
	}
*/

}
  • JS has internationalization values stored for currencies
    • Intl.getLocaleFormat()