When the ES6 came we got the modern syntax and opportunity to make our code neater.
return {
name,
text,
content,
}
Problem
Still in JSX this problem is actual.
For example, we have a bunch of variables from props, inner variables and state. They all have the same name with props of childrean components. But passing these props looks gigantic.
function ArticleDetails({ text, color }) {
const [draft, setDraft] = useState(false);
const today = new Date.now();
return (
<div>
<ArticleHeader color={color} />
<ArticleContent draft={draft} today={today} text={text}/>
</div>
)
}
Hi, this problem was searched on stackoverflow already. To me, code presented in stackoverflow answers look quite ugly.
We had a similar syntax inconvenience in JavaScript language and must have used syntax like this:
When the ES6 came we got the modern syntax and opportunity to make our code neater.
Problem Still in JSX this problem is actual. For example, we have a bunch of variables from props, inner variables and state. They all have the same name with props of childrean components. But passing these props looks gigantic.
Suggestion Implement
prop,
syntax