question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove props passed with null

See original GitHub issue

It 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:closed
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ngokevincommented, Mar 27, 2017

Yeah, null is a valid value. If you want to filter it out, you can remove it from your props.

0reactions
lennerdcommented, May 30, 2017

@ngokevin Thanks for the example! Thats what I also end up using.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found