React arroja el siguiente error al intentar inicializar el objeto Date en un componente funcional creado con el fragmento "rfc". No tengo ganchos en el componente. let dateObj = new Date() es lo único agregado además del fragmento.
Revisé mis versiones de React e intenté reiniciar el servidor. Usé create-react-app para crear mi proyecto React.
Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. import React from 'react' function Date() { let date = new Date() return ( <div>Date</div> ) } export default DateIntenta cambiar el nombre de tu función.
import React from 'react' function CurrentDate() { let date = new Date() return ( <div>Date</div> ) } export default CurrentDate