我是新来的反应js。在这里,我试图在用户单击图标时对数据进行排序。
<th scope="col">Technology <i className="fa fa-fw fa-sort sort-icon"></i></th>
Run Code Online (Sandbox Code Playgroud)
所以,现在我有了对象数组形式的数据。
在此,我有5列,每列上都有一个排序图标。那么,如何使用react来实现呢?
我想按字母顺序排序。
我的数据看起来像
[{
"id": "5b7d4a566c5fd00507501051",
"hrmsJdId": null,
"companyId": null,
"jdName": "Senior/ Lead UI Developer",
"jobDescription": null,
"technology": java,
}, {
"id": "5b7fb04d6c5fd004efdb826f",
"hrmsJdId": null,
"companyId": null,
"jdName": "Content Innovation Lead",
"jobDescription": null,
"technology": css
}, {
"id": "5b7fb0b26c5fd004efdb8271",
"hrmsJdId": null,
"companyId": null,
"jdName": "Urgent Opening for DSP Engineer/ Senior Engineer for",
"jobDescription": null,
"technology": react,
}]
<td>{item.technology}</td>
<td>17</td>
<td title={item.jdName} className="jd-name-container justify-content-center align-items-center">
<div className="jdName">{item.jdName}</div>
{(key + 1 === 1) …
Run Code Online (Sandbox Code Playgroud) 我正在使用此重定向用户:
history.push({
pathname: `${pathname}/order`,
search: qs.stringify({
id,
group,
}),
})
Run Code Online (Sandbox Code Playgroud)
在当前页面中,路径名是/app/clients/group/active
,这是我从location
.
现在,我想将用户重定向到/data
:
history.push({
pathname: `${pathname}/data`,
search: qs.stringify({
id,
group,
}),
})
Run Code Online (Sandbox Code Playgroud)
但是,pathname
has /active
,在重定向到/data
路由时不需要。
当用户在该页面上时,如何从路径名中删除它。
我是新来的react redux
。在这里我有一个delete request
export const deleterequest = (url, jdId) =>
axios.delete(
url,
jdId,
{
headers: {
"Authorization": localStorage.getItem("access_token") !== null ? `Bearer ` + localStorage.getItem("access_token") : null,
"Content-Type": "application/json"
}
}
).then(data => {
if (data.status === HttpStatus.OK) {
return {
status: data.status,
payload: data.data
};
}
}).catch(err => {
return {
status: err.response ? err.response.data : 'Network error',
payload: null
};
Run Code Online (Sandbox Code Playgroud)
所以,我尝试了这个 apporch。jdId
是一个字符串数组。所以,但是当我以这种方式使用时,我的请求标头不会显示此数据。
那么,我做错了什么。谁能帮我这个 ?
我是新来的
front-end-development
。现在,这里有下表,
<div className="table-responsive">
<table className="table table-hover" id="job-table">
<thead>
<tr className="text-center">
<th scope="col">Sr.No.</th>
<th scope="col">Company Name</th>
<th scope="col">Technology</th>
<th scope="col">Total Resumes</th>
<th scope="col">Job Title</th>
<th scope="col">Total Score</th>
<th scope="col">Average Score</th>
</tr>
</thead>
<tbody className="text-center">
{this.props.list && this.props.list.content && this.props.list.content.length > 0 && this.props.list.content.map((item, key) => {
return (
<tr key={key}>
<td className="font-weight-bold">1</td>
<td className="font-weight-bold">ABCDED</td>
<td>Software Developer</td>
<td className="font-weight-bold">17</td>
<td>5 years experience</td>
<td className="font-weight-bold">30</td>
<td className="font-weight-bold">30</td>
</tr>
)
})}
</tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
现在,在此我使用了table-responsive class
。
现在,我尝试通过使用
tbody { height: …
Run Code Online (Sandbox Code Playgroud) 我也是新手reactjs
和javascript.
在这里,我有一个对象数组,就像,
[
{
"id": "CSS",
"questionCount": [
{
"level": "TOUGH",
"type": "NON_CODE",
"count": "1"
}
]
},
{
"id": "Backbone",
"questionCount": [
{
"level": "TOUGH",
"type": "CODE",
"count": "2"
},
{
"level": "TOUGH",
"type": "NON_CODE",
"count": "5"
},
{
"level": "MEDIUM",
"type": "NON_CODE",
"count": "7"
},
{
"level": "EASY",
"type": "NON_CODE",
"count": "6"
}
]
},
]
Run Code Online (Sandbox Code Playgroud)
现在,我想要的是拥有一个对象数组,它将包含数组中存在的所有对象questionCount
.所以,它会像,
[ {
"level": "TOUGH",
"type": "NON_CODE",
"count": "1"
}, {
"level": "TOUGH",
"type": "CODE",
"count": "2"
}, …
Run Code Online (Sandbox Code Playgroud) 我正在尝试为具有以下特征的组件编写单元测试用例 Link
因此,我的组件就像
import { Link } from 'react-router-dom';
import { withRouter } from 'react-router-dom'
<div className="col-sm-4">
<Link to="create-job/new" style={{ textDecoration: 'none'}}><button type='button' className="btn btn-lg btn-primary btn-block button-container">Create New Job</button></Link>
</div>
export default withRouter(JobNotFound);
Run Code Online (Sandbox Code Playgroud)
现在,我所做的是
import JobNotFound from '../JobNotFound';
import { Link } from 'react-router';
describe('JobNotFound Component test cases', () => {
it("renders JobNotFound Component successfully", () => {
const wrapper = shallow(
<JobNotFound />
);
expect(wrapper).toMatchSnapshot();
});
it("simulate the click event on Button", () => {
const onButtonClick = …
Run Code Online (Sandbox Code Playgroud) reactjs ×6
javascript ×4
react-redux ×4
redux ×3
axios ×1
bootstrap-4 ×1
html5 ×1
jestjs ×1
react-router ×1
unit-testing ×1