My react-dates component is working, but my bundle JS file is 600kb. All I need is the DateRangePicker component and nothing more. Is it possible for me to edit the code and/or compress the bundle js file to make it smaller?
I have tried a few different builds, using the App.js and index.js code below, with all bundles still ending around 600kb. My main.0a110825.js bundle file is too large to paste here.
Here is a link that helped me get my component to work on my page, now I am just hoping to have a smaller bundle file, if possible.
Thank you for your help!
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="manifest" href="/manifest.json">
<link rel="shortcut icon" href="/favicon.ico">
<title>React App</title>
<link href="/static/css/main.1a15b309.css" rel="stylesheet">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="text/javascript" src="/static/js/main.0a110825.js"></script>
</body>
</html>
import React, { Component } from 'react';
import './App.css';
import 'react-dates/initialize';
import 'react-dates/lib/css/_datepicker.css';
import { DateRangePicker } from 'react-dates';
class App extends Component {
constructor(props) {
super(props);
this.state = {
startDate: null,
endDate: null,
focusedInput: null,
};
}
render() {
return (
<div className="App">
<DateRangePicker
startDateId="startDate"
endDateId="endDate"
startDate={this.state.startDate}
endDate={this.state.endDate}
onDatesChange={({ startDate, endDate }) => { this.setState({ startDate, endDate })}}
focusedInput={this.state.focusedInput}
onFocusChange={(focusedInput) => { this.setState({ focusedInput })}}
/>
</div>
);
}
}
export default App;
import 'airbnb-js-shims';
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();