What is the best way to add asset path variables?
I am working on an app that has a different asset dir depending on the environment (local, staging, production).
Right now, all my image paths are hard coded in the JSX which works totally fine when developing locally. However, when on staging, the asset path is slightly different.
这是我正在谈论的简单示例。
render() {
return (
<div className="home-container">
<img className="home-container__logo" src="/images/ui/logos/imagename.png" />
</div>
);
}
Run Code Online (Sandbox Code Playgroud)
imagesrc属性指向"/images". 这在其他环境中可能有所不同。
是否有添加资产路径 var …
我正在尝试使用JavaScript Insights API获取属于页面的最佳Facebook帖子列表.但是,我似乎无法通过一次API调用找到一种方法.我在这里填写了文档:https://developers.facebook.com/docs/graph-api/reference/v2.4/insights
除非我遗漏了某些内容,否则似乎没有办法简单地检索热门帖子列表并在结果中包含参与/喜欢/分享/评论等.您可以获取一般统计信息,例如页面上所有帖子的完全参与度,但没有任何内容可以通过帖子分解.
我能想到的唯一一件事就是使用Graph API获取页面帖子的列表.
/[page-Id]/posts
Run Code Online (Sandbox Code Playgroud)
然后使用这些结果中的post-Id来检索该特定帖子的洞察.
/[post-Id]/insights
Run Code Online (Sandbox Code Playgroud)
这可能会导致我进行大量的API调用以获得我正在寻找的东西.
我希望有更好的方法.有什么建议?