Skip to content

Commit

Permalink
React: fix code snippet (DevExpress#5951)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladaskorohodova committed Jan 23, 2024
1 parent b8bbb8c commit 10e97bb
Showing 1 changed file with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Pass the rendering function to the `Template`'s `render` property:

const employee = service.getEmployee();
const positions = service.getPositions();

const positionEditorOptions = {
items: positions,
value: '',
Expand All @@ -23,15 +22,12 @@ Pass the rendering function to the `Template`'s `render` property:

export default function App() {
const [upperCasePositions, setUpperCasePositions] = useState(false);

const renderSelectBoxItem = useCallback((item) => {
return <div>{upperCasePositions ? item.toUpperCase() : item}</div>;
}, [upperCasePositions]);

const onUpperCaseSettingChange = useCallback((e) => {
setUpperCasePositions(e.value);
}, []);

return (
<>
<CheckBox
Expand All @@ -55,7 +51,6 @@ Pass the rendering function to the `Template`'s `render` property:
import Form, { Item } from 'devextreme-react/form';
import { Template } from 'devextreme-react/core/template';
import { CheckBox } from 'devextreme-react/check-box';

import service from './data.js';

class App extends React.Component {
Expand All @@ -64,10 +59,8 @@ Pass the rendering function to the `Template`'s `render` property:
this.state = { upperCasePositions: false };
this.employee = service.getEmployee();
this.positions = service.getPositions();

this.renderSelectBoxItem = this.renderSelectBoxItem.bind(this);
this.onUpperCaseSettingChange = this.onUpperCaseSettingChange.bind(this);

this.positionEditorOptions = {
items: this.positions,
value: '',
Expand Down Expand Up @@ -143,7 +136,6 @@ Assign the custom component to the `Template`'s `component` property:
import { Template } from 'devextreme-react/core/template';
import { Switch } from 'devextreme-react/switch';
import { RadioGroup } from 'devextreme-react/radio-group';

import service from './data.js';

const employee = service.getEmployee();
Expand All @@ -154,7 +146,6 @@ Assign the custom component to the `Template`'s `component` property:
const onLineThroughChange = useCallback((e) => {
setLineThrough(e);
}, []);

return (
<div style={{
display: 'flex',
Expand All @@ -177,7 +168,6 @@ Assign the custom component to the `Template`'s `component` property:
value: '',
itemTemplate: 'radioGroupItem',
});

return (
<div style={{ maxWidth: 400 }}>
<Form formData={employee}>
Expand Down Expand Up @@ -205,7 +195,6 @@ Assign the custom component to the `Template`'s `component` property:
class RadioGroupItemTemplate extends React.PureComponent {
constructor() {
super();

this.state = { lineThrough: false };
this.onLineThroughChange = this.onLineThroughChange.bind(this);
}
Expand Down

0 comments on commit 10e97bb

Please sign in to comment.