I am extremely weak with javascript due to its lax syntax but very punishing special characters meaning.
In react-native-navigation tutorial there is this snippet
static navigationOptions = ({ navigation }) => {
   const {state, setParams} = navigation;
   const isInfo = state.params.mode === 'info';
   const {user} = state.params;
   return {
     title: isInfo ? `${user}'s Contact Info` : `Chat with 
 ${state.params.user}`,
     headerRight: (
       <Button
         title={isInfo ? 'Done' : `${user}'s info`}
         onPress={() => setParams({ mode: isInfo ? 'none' : 'info'})}
       />
     ),
   };
 };
Originally, I mistakenly type the third line as this:
const {isInfo} = state.params.mode === 'info';
and my code doesn't work.
What is the difference with:
const isInfo = state.params.mode === 'info';
since the next line, there is curly brace wrapping {user}
it is very confusing for me, but these kind of minor thing is notoriously difficult to Google, so sorry and thanks in advance!
 
     
     
    