During a recent code interview, I noticed a React component with a render method written in the following (abbreviated) form,
1
2
3
4
5
6
7
8
9
10
11
12
render() {
return this.state.items.length > 0 ? (
prop1={},
prop2={},
propN={},
...
/>
) : (
''
);
}
where ComponentWithLotsOfProps had at least a dozen props, some of which were not simple primitive values.
While there is nothing technically wrong with this render method, it could be better. It suffers from a few...
class="line">}whereclass="code"><td
Published on November 07, 2019 09:24