I installed react-toastr and integrated the example code.
import React from 'react'
import { ToastContainer } from 'react-toastr';
class Notifier extends React.Component
{
updateNotify()
{
this.refs.container.info('hola el mundo');
}
render()
{
return(
<ToastContainer ref="container"
className="toast-top-right" />
);
}
}
When I call info() on the container the message pops up, but just as plain text at the top of the page, not as a styled box in the upper right corner. The message also never goes away. So it looks like CSS and JavaScript components are missing.
What did I do wrong? Why those warnings about fsevents when this is being installed under Linux? I'm using react 15 if it matters. I downgraded to react-toastr version 2.9.5 but it didn't make a difference.
$ npm install --save react-toastr
[email protected] /home/myApp
└─┬ [email protected]
└─┬ [email protected]
├── [email protected]
└── [email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/react-scripts/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加