我想从 Firestore 检索单个文档。所以我的意思不是集合中的文档列表(我知道怎么做)。假设我知道文档的键值对之一,我想查找文档并将其检索到 Angular 4 中。
interface Occupations {
	duration: number;
	id_entity: number;
	id_job: number;
	id_user: number;
	salary: number;
	start_time: number;
}
occupationDoc:AngularFirestoreDocument<Occupations>;
occupation: Observable<Occupations>;Run Code Online (Sandbox Code Playgroud)
<h1>A specific post:</h1>
  <h3>{{ (occupation | async)?.salary }}</h3>
  <p>{{ (occupation | async)?.id_user }}</p> 
  <p>{{ (occupation | async)?.duration }}</p> 
  <p>{{ (user | async)?.lastName }}</p> Run Code Online (Sandbox Code Playgroud)
这是我想使用我的钩子的地方,以便我可以在应用程序运行期间更改一种状态。
export const simpleFunction = () => (state) => {
   // here is the hook 
}
Run Code Online (Sandbox Code Playgroud)
我知道反应钩子应该用在功能组件中,但是上面提到的情况又如何呢?