I have forked this sanbdbox in order to re-build it into a functional component for a project. But I am not sure why it is not working properly! If you compare it side by side you might see something I don't at the moment.
For example I drag the node and nothing changes at all.
Here's my repo in GitHub or a CodeSandBox.
Any help would be appreciated! :)
I did try to refactor it into a functional component but I am missing something.
Related
I have an issue with a project I'm working on.
I tried to implement "dynamic" routing and rendering of components, but it seems to just not work.
I have added a sandbox link containing some of the routes and basic components along with the structure I was going for.
It seems as if I hard code the routes and components to render, everything works, but when I use the component that accepts the component, it won't render. I am not sure why.
I would appreciate any help or insight anyone is willing to give.
Edit on sandbox
I was working on a react js project...now I have deleted a component and it's showing an error after a while as previously I have imported the same component somewhere else too. I wanted to know if there is any way to find out where I have imported that component using a direct key or something rather than doing with the hard way and going each file one by one.
Also, the editor I'm using is vscode if this information is helpful.
Found the solution someone posted earlier, it was helpful.
here
thanks
I have created one search component using stencil and I'm integrating this stencil codebase with my react application via cdn link. I'm displaying the search component(which was created in stencil) as below in my react codebase :
<custom-search placeholder="Search"></custom-search>
The search component contains a search icon. I need to pass the text in search input field to my react code on click of this icon. How can this be achieved?
Unfortunately I haven't integrate Stencil JS component with React, but passing string data to web component should be working without too much hassle. Do you know if your React app can properly recognize your custom-search component? If not, then you might want to take a look at a link to Stencil JS official document of integrating Stencil JS component to React and make sure component get properly loaded and integrated.
If you know for sure you load the component then not sure why your placeholder is not set within your component - it is just a string after all. Maybe post the custom-search component code, as there might be issue with that (i.e. component lifecycle event you are using might not be doing what you expect to do)
Could you clarify the actual problem, please? :)
Does the component not get rendered, or are you unable to achieve communication from custom-search to the React app?
If the latter is the case, you might want to implement a Custom Event on the Stencil component, to communicate changes back to the consuming app.
As #tomokat mentioned, you should follow the official Stencil React integration docs. This is required, since React cannot handle Custom Events natively, and requires some help from the dev.
Edit: Sorry, I got confused by the first answer. Your title is quite clear, though. If you can show some example code of the component and the React integration, we could probably help in a better way.
I am using React-Redux-Form and React-Bootstrap on client side of application.
I'm stuck on how to testing my components. I have made a small project on github with one of my components named LoginModal:
https://github.com/DmitryIvanovIAMM/react-redux-form-login-test/blob/master/src/tests/Foo-test.js.
To start testing, I am following this tutorial https://www.codementor.io/vijayst/unit-testing-react-components-jest-or-enzyme-du1087lh8.
But when I try to .find() button in my rendered component, the result is an array of length zero. So I can't simulate its behaviour. I try find it (button) several different way but unsuccessful. Please, your suggestion.
This issue is with the rendering of Modal component that is part of #react-bootstrap. There is a discussion about it on https://github.com/react-bootstrap/react-bootstrap/issues/876.
The alternative is to use ReactModal from react-modal. Testing it is described on http://remarkablemark.org/blog/2017/05/17/testing-react-modal/
Im trying to create an application targettng both web and mobile. The idea is to create react components that differ on how they render but share the logic.
React v.014 blog post stated "we’re splitting the main react package into two: react and react-dom. This paves the way to writing components that can be shared between the web version of React and React Native.
The react package contains React.createElement, .createClass, .Component, .PropTypes, .Children, and the other helpers related to elements and component classes. We think of these as the isomorphic or universal helpers that you need to build components."
I've found a great example (http://blog.benoitvallon.com/projects/a-mobile-desktop-and-website-app-with-the-same-code/) that uses the same concept and accomplished the result (react-native 0.13.6 and react 0.14.2).
In this code, you will see nothing special just a smart idea on how to extend react-native naming conventions system to include a web version. The minute I upgrade to latest react-native, it complaints about any component that uses React.Component from the react package instead of react-native.
This is confusing since 0.14 release seem to indicate that was exactly the point moving fw. Let React create components, let react-dom deal with the DOM and let react-native deal with ios/android views.
I think this is a brilliant idea but I cant seem to pass this particular problem. Any thoughts, ideas will be greatly appreciated.
Thanks
The transition to make react native work this way is underway but incomplete. See AMA.
We are working hard to stop using our fork such that people can use require('react') and work the same as require('react-native'), this will make it possible for all the third party plugins to work on both places without doing anything.
Right now we can't use relay on the open source version of react-native without forking it, which is a huge shame and we're working on fixing that.