Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
¿Usando esto en estado inicial redux?

Quiero establecer cierta propiedad del estado inicial para que sea relativa a otra propiedad. Así que usé this dentro de él.

 const initialState = { canvas_1: { canvasName: "canvas_1", top: 500, left: 600, width: 390, height: 800, xAxisSnap: [0, this.width / 2, this.width], <-- here yAxisSnap: [0, this.height / 2, this.height], <-- here selectedShapes: [], children: ["hi"], }, }; const canvasSlice = createSlice({ name: "canvas", initialState: initialState, reducers: {}, }); export const selectShapesOnCanvas = (state) => state.canvas.present.children; export const {} = canvasSlice.actions; export default canvasSlice.reducer;

Pero esto es lo que obtuve a cambio de webpack.

 var initialState = { canvas_1: { canvasName: "canvas_1", top: 500, left: 600, width: 390, height: 800, xAxisSnap: [0, undefined.width / 2, undefined.width], <-- here yAxisSnap: [0, undefined.height / 2, undefined.height], <-- here selectedShapes: [], children: ["hi"] } }; var canvasSlice = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createSlice)({ name: "canvas", initialState: initialState, reducers: {} }); var selectShapesOnCanvas = function selectShapesOnCanvas(state) { return state.canvas.present.children; }; _objectDestructuringEmpty(canvasSlice.actions); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (canvasSlice.reducer);

¿Estoy usando this de manera incorrecta o no this permitido usarlo en RTK?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!