You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
return{name: name,text: text,content: content,}
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.
functionArticleDetails({ text, color }){const[draft,setDraft]=useState(false);consttoday=newDate.now();return(<div><ArticleHeadercolor={color}/><ArticleContentdraft={draft}today={today}text={text}/></div>)}
The text was updated successfully, but these errors were encountered:
platonlukyanov
changed the title
Proposal: React's props with the same name as their value
Proposal: Attributes with the same name as their value
Apr 3, 2022
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,
syntaxThe text was updated successfully, but these errors were encountered: