A highly opinionated standard driven from the lifestyle of a friendly javascript developer. Some of the simple things that we often miss which could make our day to day development work easy and efficient.
import React from "react";
import moment from "moment";
// Absolute imports after the imports from node_modules
import Button from "src/views/atoms/buttons";
import Label from "src/views/atoms/label";
import Placeholder from "src/views/atoms/placeholder";
import TextInput from "src/views/atoms/text-input";
// Relative imports after the absolute imports
import Button from "../atoms/buttons";
import TextInput from "../atoms/text-input";
import React from "react";
export const ComponentWithoutSortedProps = () => {
// I have unsorted props
return <DummyComponent
ironMan={ironMan}
thor={thor}
blackPanther={blackPanther}
wasp={wasp}
antMan={antMan}
hulk={hulk}
hawkEye={hawkEye}
quickSilver={quickSilver}
scarletWitch={scarletWitch}
blackWidow={blackWidow}
warMachine={warMachine}
moonKnight={moonKnight}
spiderMan={spiderMan}
doctorStrange={doctorStrange}
deadpool={deadpool}
yondu={yondu}
loki={loki}
captainAmerica={captainAmerica}
winterSoldier={winterSoldier}
/>;
}
import React from "react";
export const ComponentWithSortedProps = () => {
// I have sorted props
return <DummyComponent
antMan={antMan}
blackPanther={blackPanther}
blackWidow={blackWidow}
captainAmerica={captainAmerica}
deadpool={deadpool}
doctorStrange={doctorStrange}
hawkEye={hawkEye}
hulk={hulk}
ironMan={ironMan}
loki={loki}
moonKnight={moonKnight}
quickSilver={quickSilver}
scarletWitch={scarletWitch}
spiderMan={spiderMan}
thor={thor}
warMachine={warMachine}
wasp={wasp}
winterSoldier={winterSoldier}
yondu={yondu}
/>;
}
export const doVeryLongTaskWithMultipleReturns = (v1, v2) => {
const x = 'something great';
const y = 'another thing that is great';
if(x === v1) {
return x;
}
if (y === v2) {
const thing1 = 'hello world';
const thing2 = 'world hello';
const joinedThing = thing1 + thing2;
return joinedThing;
} else {
if (v1 === v2) {
const gettingOverIt = 'impossible';
const gettingBelowIt = 'impossible';
const joined = gettingOverIt + gettingBelowIt;
return joined;
}
}
return y;
};
export const doVeryLongTaskWithMultipleReturns = (v1, v2) => {
const x = 'something great';
const y = 'another thing that is great';
if(x === v1) {
return x;
}
if (y === v2) {
const thing1 = 'hello world';
const thing2 = 'world hello';
const joinedThing = thing1 + thing2;
return joinedThing;
} else {
if (v1 === v2) {
const gettingOverIt = 'impossible';
const gettingBelowIt = 'impossible';
const joined = gettingOverIt + gettingBelowIt;
return joined;
}
}
return y;
};
From us to your inbox weekly.