-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support auto inject props for initialState
- Loading branch information
1 parent
9ac3af5
commit be51a3e
Showing
19 changed files
with
1,716 additions
and
1,556 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
import React from "react"; | ||
import { connect } from "react-redux"; | ||
import { apiName } from "config/api"; | ||
import { getDataAction_Server } from "store/reducer/server/share/action"; | ||
|
||
import type { StoreState } from "types/store"; | ||
import type { GetInitialStateType, PreLoadComponentType } from "types/components"; | ||
|
||
const Great: PreLoadComponentType<{ blog: string[] }> = (props) => { | ||
console.log(props, "666"); | ||
return <div>Great rt</div>; | ||
console.log(props, "test auto inject"); | ||
return <div>Great rt, {props?.blog?.join(", ")}</div>; | ||
}; | ||
|
||
export const getInitialState: GetInitialStateType = async ({ store }) => { | ||
console.log("开始222"); | ||
await store.dispatch(getDataAction_Server({ name: apiName.blog })); | ||
console.log(store.sagaTask?.isRunning(), store.sagaTask?.isCancelled()); | ||
console.log("dispatch done"); | ||
return { props: { blog: [1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 0] } }; | ||
}; | ||
|
||
export default connect((state: StoreState) => ({ | ||
blog: state.server.blog.data, | ||
}))(Great); | ||
export default Great; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.