Remove props passed with null
See original GitHub issueIt would be nice, if the Entity
component filters received props to exclude null
values and instead uses to the default A-Frame value. IMHO this would more conform with the way React handles null
values.
This would also make it simpler to add default props passed to entities. For example:
class Camera extends Component {
static defaultProps = {
position: null,
};
render() {
const { position } = this.props;
const camera = {
userHeight: 1.6,
};
return (
<Entity
position={position}
camera={camera}
look-controls
/>
);
}
}
At the moment this produces the following error at https://github.com/ngokevin/aframe-react/blob/master/src/index.js#L104:
Uncaught TypeError: Cannot read property 'constructor' of null
With a okay from you @ngokevin I could build a small PR for this.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to remove null values from props.map - Stack Overflow
I'm maping from props to 'lawList', but the array contains alot of nullValues that i wish to prevent. {props.map((lawList, index) => ( <Table....
Read more >Multivalue - Removing all selected items send null on ... - GitHub
We rectify this in 3.0.0, on removal of all selected values in an isMulti Select, the value passed to onChange is null and...
Read more >Unknown Prop Warning - React
The unknown-prop warning will fire if you attempt to render a DOM element with a prop that is not recognized by React as...
Read more >Warning: Each Child in a List Should Have a Unique 'key' Prop
Learn what causes"Warning: Each child in a list should have a unique 'key' prop."
Read more >delete operator - JavaScript - MDN Web Docs - Mozilla
Description · If the property which you are trying to delete does not exist, delete will not have any effect and will return...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah,
null
is a valid value. If you want to filter it out, you can remove it from your props.@ngokevin Thanks for the example! Thats what I also end up using.