I have an object with some properties like
weather.name = 'Coudy'
weather.country= 'USA'
Currently I am using Object destructuring in ES6 but as you can see it is quite verbose. I would like to know if it is possible to rewrite in a more concise way this code.
Notes: I am using babel with
"presets": ["es2015", "react", "stage-2"]
const Weather = ({ weather }) => {
let {
name,
country,
temperature,
temperatureMin,
temperatureMax,
weatherMain,
weatherDescription,
weatherIcon,
updatedTime,
windDegree,
windSpeed,
visibility
} = weather
return (<div>
{ name }, { country }
{ temperature }
{ temperatureMin }
{ temperatureMax }
{ weatherMain }
{ weatherDescription }
{ weatherIcon }
{ updatedTime }
{ windDegree }
{ windSpeed }
{ visibility }
</div>
)
}
export default Weather
({ weather }) => (<div> { Object.values(weather).join("\n") } </div>)