This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Old, old function that lives here from the scratch | |
function multiply (a, b) { | |
return a * b; | |
} | |
function sum (a, b) { | |
return a + b; | |
} | |
function calculateSomethingSpecial(data) { | |
return data.map( | |
dataItem => sum(dataItem.param1, dataItem.param2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function sum (a, b) { | |
return a + b; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sum from "./sum"; | |
export default function calculateSomethingSpecial(data) { | |
return data.map( | |
dataItem => sum(dataItem.param1, dataItem.param2)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiply from '../utils/multiply'; | |
import sum from '../utils/sum'; | |
import calculateSomethingSpecial from '../utils/calculateSomethingSpecial'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export { default as sum } from './sum'; | |
export { default as multiply } from './multiply'; | |
export { default as calculateSomethingSpecial } from './calculateSomethingSpecial'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { multiply, sum, calculateSomethingSpecial } from '../utils'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import { sum } from "./utils"; | |
import "./styles.css"; | |
function App() { | |
return ( | |
<div className="App"> | |
<h1>Re-export example</h1> | |
<p>{sum(5, 10)}</p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(window.webpackJsonp = window.webpackJsonp || []).push([[0], { | |
10: function(e, n, t) { | |
"use strict"; | |
t.r(n); | |
// So here is our function compiled inside a component | |
var r = t(0) | |
, a = t.n(r) | |
, c = t(2) | |
, o = t.n(c); | |
function l(e, n) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(window.webpackJsonp = window.webpackJsonp || []).push([[0], { | |
10: function(e, n, t) { | |
"use strict"; | |
t.r(n); | |
var a = t(0) | |
, r = t.n(a) | |
, c = t(2) | |
, l = t.n(c); | |
t(9); | |
var o = document.getElementById("root"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import { multiply, sum, calculateSomethingSpecial } from "./utils"; | |
import "./styles.css"; | |
function App() { | |
const specialData = [ | |
{ | |
param1: 100, | |
param2: 99 | |
}, |
OlderNewer