- Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathclientRegistration.jsx
52 lines (44 loc) · 1.41 KB
/
clientRegistration.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* global document, $ */
// polyfills
import'whatwg-fetch'
import'pusher-js'
importturbolinksfrom'turbolinks'
import{Provider}from'react-redux'
importReactfrom'react'
importReactOnRailsfrom'react-on-rails'
importstorefrom'../stores/store'
importHeartfrom'../components/Heart'
importHeartButtonfrom'../components/HeartButton'
importNewJobfrom'../components/NewJob'
importNewJobSubscriptionfrom'../components/NewJobSubscription'
importProtipSubscribeButtonfrom'../components/ProtipSubscribeButton'
importSponsorsfrom'../components/Sponsors'
turbolinks.start()
ReactOnRails.setOptions({
traceTurbolinks: TRACE_TURBOLINKS,// eslint-disable-line no-undef
})
ReactOnRails.registerStore({ store })
functionwithStore(c){
returnprops=>React.createElement(
Provider,
{store: ReactOnRails.getStore('store')},
React.createElement(c,props)
)
}
functionregisterContainers(containers){
constcontainersWithStore=Object.keys(containers).
reduce((h,k)=>({ ...h,[k]: withStore(containers[k])}),{})
ReactOnRails.register(containersWithStore)
}
// Only container compoments need to be registered here
// container components are rendered directly in view html
// components that are children of containers don't need to be registered
registerContainers({
Heart,
HeartButton,
NewJob,
NewJobSubscription,
Sponsors,
ProtipSubscribeButton,
})
require('./confirm')