Package Exports
- bs-react-transition-group/src/Transition.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bs-react-transition-group) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
bs-react-transition-group
Usage
type state = {start: bool};
type action =
| Start
| End;
let component = ReasonReact.reducerComponent("Example");
let make = (_children) => {
...component,
initialState: () => {start: false},
reducer: (action, state) =>
switch (action) {
| Start => ReasonReact.Update({...state, start: true})
| End => ReasonReact.Update({...state, start:false})
},
render: self =>
<div>
<Transition timeout=600 in_=self.state.start>
...((animationState) =>
switch(animationState) {
| Transition.Entering => (ReasonReact.string("State: " ++ "Entering"))
| Transition.Entered => (ReasonReact.string("State: " ++ "Entered"))
| _ => (ReasonReact.string("State: " ++ Transition.stringOfState(animationState)))
}
)
</Transition>
<button onClick=(_ => self.send(Start)) disabled={self.state.start}>
(ReasonReact.string("Start Animation"))
</button>
<button onClick=(_ => self.send(End)) disabled= {! self.state.start}>
(ReasonReact.string("End Animation"))
</button>
</div>
};