0

In this code the newArr is having a data like enter image description here and i want to display which type=="sent" should be display in right side and other data should be dipalyed on left side . But the issue is data is not diaplying .please help me thanks in advance

  { newArr ? newArr.map((m) => {
            (m.type === "sent") ? 
            <div style={{float:"right"}}>{m.msg}</div>
            : <div style={{float:"left"}}>{m.msg}</div>
          }): null }
sonam
  • 105
  • 8

1 Answers1

0

You should return after the condition returned

 `{newArr ? newArr.map((m) => {
      return  (m.type === "sent") ? 
         <div style={{float:"right"}}>{m.msg}</div>
         :<div style={{float:"left"}}>{m.msg}</div>
       }): null }`
Harrison Ho
  • 79
  • 1
  • 3