0

I can use this way to prevent undefined error when the object is undefined , but it not work in React. i want to know is this ES6’syntax or other syntax?

3
  • Why is it related to Angular? Commented Feb 23, 2017 at 3:19
  • sorry ; forgot to say that: i can use this syntax in angular2 project.but doesn't work in react project Commented Feb 23, 2017 at 3:25
  • 2
    "EC6’syntax or other syntax?" Not it's not. Seems to be some custom syntax from angular. Commented Feb 23, 2017 at 3:43

1 Answer 1

4

The safe navigation operator is a feature of Angular, and not part of the JavaScript langauge. As a result, it will not work in React applications.

Sign up to request clarification or add additional context in comments.

2 Comments

Usually people use _.get from lodash.
but lodsh not work too..i don't know why every time i got undefiend such as _.get({name:"123"},'name') and returned undefined

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.