在 React Native 中,我们可以选择使用 Alert 在弹出窗口中通知用户。这些“简单”警报可以由以下内容组成:
Alert.alert('Hello world!')
它产生一个带有消息、没有标题和一个“确定”按钮的警报。
您还可以制作 2 或 3 个按钮警报,其组成如下(2 个按钮示例):
Alert.alert(
'Alert Title',
'My Alert Msg',
[
{
text: 'Ask me later',
onPress: () => console.log('Ask me later pressed')
},
{
text: 'Cancel',
onPress: () => console.log('Cancel Pressed'),
style: 'cancel',
},
{
text: 'OK',
onPress: () => console.log('OK Pressed')
},
],
{cancelable: false},
);
Run Code Online (Sandbox Code Playgroud)
注意这里你有onPress按钮功能的选项
我想知道的是onPress,当按下“确定”时,我是否可以为第一种情况申请,但官方文档中没有示例(或任何细节!)
也许这(还)不可能。任何人都可以确认或否认吗?
我正在尝试获取 .NET API,以便能够连接到我的 docker 网络上的 Redis 实例。这是我所得到的:
my-networkRedis 容器:在自定义 docker 网络上启动并运行localhost:6379my-network(也许?)相关版本控制:
我已经尝试了所有方法,network inspect在网络中添加和删除两个容器,甚至resolveDns=true在我的 .NET 代码中使用特殊的连接字符串标志。无论我做什么我都会得到:
StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s). UnableToConnect on localhost:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.1.58.34321
Run Code Online (Sandbox Code Playgroud)
我在这里失去了理智,Redis 已localhost:6379在 docker 网络上启动并运行,为什么 …
官方Redux Toolkit 文档建议输入RootState以下内容:
import { configureStore } from '@reduxjs/toolkit'
// ...
export const store = configureStore({
reducer: {
posts: postsReducer,
comments: commentsReducer,
users: usersReducer,
},
})
// Infer the `RootState` and `AppDispatch` types from the store itself
export type RootState = ReturnType<typeof store.getState>
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch
Run Code Online (Sandbox Code Playgroud)
但是,当将 Redux 与 Gatsby 等服务器端渲染 (SSR) 框架一起使用时,我需要将 configureStore 调用导出为可调用函数,因此我可以确保它仅实例化一次:
import { configureStore } from '@reduxjs/toolkit'
// ...
// …Run Code Online (Sandbox Code Playgroud) 这更多的是一个语法问题,而不是一个实际的错误或错误,因为我终于得到了我想要的工作。但我想了解并改进我当前的解决方案。
假设我有一个Users表,与 table 具有一对多关系Posts,还有一个进一步的一对一关系表Authors- 每个表一个Post。
我想编写一个自定义存储库函数来获取 all Users、 with all Posts、 with every Authorper Post。
我想我可以做这样的事情:
public IQueryable<User> GetUsersWithPostsAndAuthors()
{
var query = GetAll();
// include all details on user object
return query
.Include(user => user.Posts.Select(x => x.Author));
}
Run Code Online (Sandbox Code Playgroud)
它似乎不包括该Author实体。实际上,我收到以下错误:
Lambda expression used inside Include is not valid.
Run Code Online (Sandbox Code Playgroud)
然后我想也许这些Posts需要首先出现在查询中,所以我尝试了以下方法:
Lambda expression used inside Include is not valid.
Run Code Online (Sandbox Code Playgroud)
不幸的是,我遇到了同样的错误:
Lambda expression used …Run Code Online (Sandbox Code Playgroud) .net ×1
alert ×1
c# ×1
docker ×1
javascript ×1
react-native ×1
reactjs ×1
redis ×1
redux ×1
typescript ×1