Comments (8)
What's reacts error when you merge? I use mergerefs all the time and never saw a warning, must be something else imo
from react-postprocessing.
@drcmda here is the error I get:
Warning: [object Object]: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop.
it happens when I try to merge refs[i]
and el.props.ref
here's a demo of this case: https://codesandbox.io/s/trying-to-get-effect-ref-9zzl1?file=/src/App.js
from react-postprocessing.
try clone in that case https://reactjs.org/docs/react-api.html#cloneelement
Clone and return a new React element using element as the starting point. The resulting element will have the original element’s props with the new props merged in shallowly. New children will replace existing children. key and ref from the original element will be preserved.
from react-postprocessing.
@drcmda maybe I'm using this wrong but it's still { current: undefined }
:/
I used this StackOverflow answer so the code looks like this:
and in demo it looks like this:
Even if it is said that cloneElement
preserves refs, looks like here it gets overidden anyway.
from react-postprocessing.
I've set up a codesandbox to debug the composer easier, but still no result yet :/
https://codesandbox.io/s/boring-noether-7uli0?file=/src/components/EffectComposer.tsx
it's being undefined
from react-postprocessing.
@drcmda so I talked to some guys in a React chat on Telegram and came to a conclusion that the whole EffectComposer
implementation is wrong. We cannot merge refs, neither we can't assign them because they are occupied already even with cloneElement
I think that it's worth trying to implement it with children again, but there is a problem with state.... we can't have state if don't render children but just map through them and send to EffectPass
any ideas?
should I keep the existing implementation and keep trying to make it work (but I honestly don't know what else to try)
or it's better to completely rewrite the composer and effects?
from react-postprocessing.
I think I got something: https://codesandbox.io/s/intelligent-dhawan-yo4lj?file=/src/App.tsx
might be some unexpected problems though
from react-postprocessing.
Fixed in last version, works nicely!
from react-postprocessing.
Related Issues (20)
- Next 13+ EffectComposer Import Error HOT 3
- Added the Custom Effect of Sharpeness
- Live demo broken
- Remove yarn, just adds complexity
- "no exported member" errors when using NodeNext module/moduleResolution in TypeScript
- Selection causes endless loop
- DepthOfField issue: white halo around objects when using resolutionScale < 0.5
- Upgrade `postprocessing` dependency to latest HOT 4
- No tone mapping exposure support HOT 3
- ToneMappingMode is not re-exported. This can lead to confusion due to how Typescript handles enums
- Current state of SSR
- Memory leak when switching cameras HOT 2
- Configure SMAA
- Invalid value used as weak map key in postprocessing
- [Bug] - N8AO works incorrectly with adaptiveDpr
- Shockwave on cloned objects HOT 1
- Modify Godrays props
- When using `EffectComposer`and `GizmoViewport`, `GizmoViewport` disappears
- if there a way to get gl.info from renderpass? HOT 1
- EffectComposer doesn't work properly inside of drei View component.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-postprocessing.