Lilp Lilp - 1 year ago 62
Javascript Question

Formatting multiple props in react-native stateless component

I am trying to find the best practices for formatting a stateless component which has multiple props. I understand that the norm is to do the following:

const myItem = ({myProp, AnotherProp}) => {


I would like to understand how best to approach this when the number of props means the length of line containing myItem would mean it extends 80 characters. I have looked at style guides such as the Air BnB React guide and also their Javascript guide, but still I haven't found the correct approach here.

Answer Source

The exact way you might be looking for is this:

const myItem = (props) => {
   const { myProp,AnotherProp } = props  
   console.log('all props extracted', myProp,AnotherProp) 

Cheers :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download