Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 如何使用动态构造的字符串使react路由器工作_String_Reactjs_Variables_Dynamic_Routing - Fatal编程技术网

String 如何使用动态构造的字符串使react路由器工作

String 如何使用动态构造的字符串使react路由器工作,string,reactjs,variables,dynamic,routing,String,Reactjs,Variables,Dynamic,Routing,我需要基于动态构造的字符串执行路由。类似于城市寄宿家庭id,其中城市和id被动态替换。我将如何使它与反应路由器一起工作 例: www.xxx.com/atlanta-homestay-12345 谢谢只需在组件中使用动态路由和访问Id 请通过:。请添加更多关于您已经尝试过的内容的详细信息。感谢您的回复。我能做点像这样的事吗 const { match: { params } } = this.props; console.log(params.cityId);

我需要基于动态构造的字符串执行路由。类似于城市寄宿家庭id,其中城市和id被动态替换。我将如何使它与反应路由器一起工作

例: www.xxx.com/atlanta-homestay-12345

谢谢

只需在组件中使用动态路由和访问Id


请通过:。请添加更多关于您已经尝试过的内容的详细信息。感谢您的回复。我能做点像这样的事吗
const { match: { params } } = this.props;
console.log(params.cityId);