Codesandbox.io is an open-source online code editor supporting vanilla JS, Vue.js, Angular.js, React.js, and Preact.js. DO NOT use this tag just because your code is hosted on CodeSandbox, and your problem is otherwise unrelated to the CodeSandbox site.
Questions tagged [codesandbox]
276 questions
0
votes
0 answers
react ref implementation doesn't work on codesandbox but works on local
Scenario
I've created demo application using React, D3 and ref, it works perfectly fine on my local machine but it's not working when I do same on codesandbox.
Codesandbox…

Indrajeet Latthe
- 374
- 1
- 8
- 22
0
votes
1 answer
How to set up a simple pie chart using React in ChartJS on codesandbox
Following the react-chartjs-2 documentation and setting up a Pie chart on codesandbox gets everything working, except the options don't work.

JimmyTheCode
- 3,783
- 7
- 29
- 71
0
votes
2 answers
how to use require(chart.js) in codesandbox
I was trying to do this in a codesandbox:
const Chart = require("chart.js");
plot() {
this.chart = new Chart(this.chartRef.current, {
..
}
]
}
});
}
However, I get an error on require:
Cannot find name…
user13067694
0
votes
1 answer
Use d3 csv inside a Codesandbox
I'm trying to create a basic data visualization using D3. As editor I would like to use Codesandbox.
So I create a data folder and inside it I put my dataset.csv file.
Then, this is my code:
import * as d3 from "d3";
const something =…

whitecircle
- 237
- 9
- 34
0
votes
1 answer
How to set up remove item buttons in vanilla-typescript todo app
I am creating a basic todo list app using vanilla typescript. After appending buttons to each list item, I want the items to delete when the user clicks the button on a specific list item. To execute this, I tried adding a 2nd addEventListener…

JS_is_awesome18
- 1,587
- 7
- 23
- 67
0
votes
2 answers
React application created using create-react-app increments module-scoped variable without reason
I have a React application created using create-react-app. I was testing something and created the following piece of code:
import React, {useState} from "react";
var a = 1;
function useForceUpdate() {
const [state, setState] = useState(true);
…

asharpharp
- 169
- 1
- 9
0
votes
1 answer
codesandbox.io / vuetify: two "identical" projects behaving differently
I have two "identical" sandboxes,
Sandbox A and Sandbox B
I trimmed down the files and code to a minimum, and copy-pasted the code from one to the other,
including the package.json, so they should even have the same dependencies.
The only difference…

ntg
- 12,950
- 7
- 74
- 95
0
votes
0 answers
CodeSandbox code is not the same as the code when deployed to netlify
In the CodeSandox live preview this is what happens when I hover over my Instagram div element:
CodeSandbox
In netlify this happens: actual website
I am wanting my website to actually look like my CodeSandbox result does anyone have any ideas as to…

Jordan Trempert
- 1
- 1
0
votes
0 answers
why this promise then execute twice in codesandbox?
why the console.log(props.name + " promise" + i); log twice ?
Code is Here
let i = 0;
function CompHook(props) {
console.log(props.name + " CompHook render" + i);
Promise.resolve().then(() => {
i++;
console.log(props.name + " promise"…

tkitesy
- 11
0
votes
2 answers
Codesandbox.io sending back html data instead of Json data
I'm currently working on a code problem on codesandbox where I am trying to use a http get request to retrieve json data from the link provided. However, when I console.log the response, I'm only receiving html data, which I have never seen before…
user14370127
0
votes
1 answer
ReactJS markdown editor component fails to render
I'm learning React at the moment, and I am currently trying out the Slate Markdown Editor in CodeSandbox. I am trying to initialize a Slate Editor instance like this:
import React from "react";
import ReactDOM from "react-dom";
import…

JS4137
- 314
- 2
- 11
0
votes
1 answer
React is not defined in Codesandbox, working fine locally
Just wanted to host some sample code on Codesandbox, but this code in MyTable.tsx
import { FC, useState } from "react";
interface Row {
id: number;
content: string;
}
interface Props {
initialRows: Row[];
}
export const MyTable: FC =…

stefan.at.kotlin
- 15,347
- 38
- 147
- 270
0
votes
0 answers
React hooks not giving updated state
Please access the code at below link :
https://codesandbox.io/s/notification-co637
Now in file : Notificaitons.js. :
#1 :My comp. is rendered twice, Why?
#2 : When i click on button,i am publishing the event but my localState is always having…

Optimus
- 116
- 1
- 7
0
votes
1 answer
In Codesandbox, Why cant you make private class fields? (Javascript)
Question
For some reason, every time I try to make a private class field in Codesndbox, it shows this:
`SyntaxError: /Binary.js: Unexpected character '#' (7:2)`
### SyntaxError ###
**/Binary.js: Unexpected character '#' (7:2)**
>#privateMethod()…

Errorbot1122 THE SECOND
- 68
- 10
0
votes
1 answer
React WebStorm DevTools like in Codesandbox?
I've got pretty great time with React DevTools codesandbox.io with all React app structure and I can see there all the props and states.
Is there any way to get these tools in WebStorm?

Zak the Gear
- 131
- 2
- 14