Loldawg

Untitled

Oct 1st, 2018
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Static function - when called returns whatever is after =>
  2. const Lambda = () => <h1>return goes here </h1>;
  3.  
  4. // Process function - does something anad returns whatever is after return
  5. const LambdaWithProcess = () => {
  6.     const sth = 'sthelse';
  7.     return <h1>return goes here </h1>;
  8. };
  9.  
  10. // Static with ONE prop - returns whatever you feed it (eg LambdaWithProp(sth) returns <h1>sth</h1>)
  11. const LambdaWithProp = prop => (
  12.         <h1>{prop}</h1>
  13.     );
  14.  
  15. // Static with 1+ prop - returns whatever PROPS you feed it, if you give it one prop, errors out
  16. const LambdaWithPropS = (prop, index) => (
  17.     <h1>
  18.         {index}
  19.         {prop}
  20.     </h1>
  21. );
  22.  
  23. // Static with processing - returns whatever you feed it and it processes it.
  24. const LambdaWithPropsAndProcessing = (prop1, prop2) => {
  25.     const something = prop1 - prop2;
  26.     return (
  27.         <h1>{something}<h1>
  28.     )
  29. }
Advertisement
Add Comment
Please, Sign In to add comment